uiview - Conceptualizing Cocoa Touch Views, Controllers & OO programming in general -


This is a very high level, but the cocoa is large and I'm still trying to get my head around it. Can someone validate my expectations ...

Say I want a number of screen scenes on screen (for example a car image), which the user can touch and rotate around Will you start sub-classing with UIView UIImage property (as opposed to UIImageView or UIButton) then the "Red", "blue" and "yellow" cars in the view controller are immediately called and stored in the NSMUTABABEER Rte are?

I can set the initial layout in the interface builder but not sure how to connect the custom objects back into the array? Need to start something in the roaming state? Is not able to detect the rotating in the IB?!? That's why I'm guessing in this case that it would be better to create the initial position in the code before the scene is displayed.

Finally, once displayed, touch the animation and logic to add, remove and count "car" in touch controller?

It seems that you are on the right track, I try to fulfill all your expectations at once

  1. The onscreen idea can be a custom UIView subclass or UIImageViews. You can think of other functionality that you want to add in the future. The UIView approach provides the most flexibility, and will also allow you to operate the rotation by portraying the image of the car manually. To do this, create a subclass for UIView, give it an image property and rotation property, and then override the "DrawRect: (CGRect) rect" function to attract the image.

  2. An array of cars is mounted in the view controller.

  3. Storing the initial layout in the interface builder NIB file is usually the best bet, it allows you to easily change the interface in the future, and many boilerplate codes are excluded. Which makes things that need to be created and created on-screen. He said, it is not possible to pair a bunch of scenes in an array outlet. In this particular case, I make the view controller's "viewedload" function many cars I will implement for You were on the right track!

    It is not possible to set up rotation in the interface builder because it is not a popular choice. You can use conversion animation to set rotation properties using rotation and then manually drag the picture at an angle.

    Hope this helps!

    EDIT: Here is some sample code to draw a picture at an angle. It uses quartz (also known as core graphics) - so much information is available in Apple document

      - drawRect: (CGRect) r {// Get graphing references Currently CGContextRef c = UIGraphicsGetCurrentContext (); // "Graphics State" to save it so that the rotation of our coordinate location can be removed. CGContextSaveGState (c); // Rotate the coordinate position by 90 degrees (in radians) in quartz, images are / always "ready", but using CTM conversion, you can change "up"! // You can also use TransWitM and Scale CTM to manipulate other properties of the coordinating space. CGContextRotateCTM (c, M_PI / 2); // Make a picture to fill our entire scene Note that if you want the image to be semi-transparent, // should have opaque = no and background color = [UIColor clearColor]! CGContextDrawImage (c, self.bounds, [[UIImage imageNamed: @ "image_file.png"] CGImage]); / Restoring the graphics status we could just rotate by -M_PI / 2, but for complex changes // it is very easy. CGContextRestoreGState (c); }  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -