The iPhone developer's cookbook (5)

Source: Internet
Author: User
Tags string back

Taking notes in this way will seriously affect reading efficiency. Is there any better way. I am a bit lazy and don't want to remember it. Ah, you still cannot give up. please stick to it this time.

Uiviewcontrollers
Navigation controllers let users move soothly between views (or, more accurately, view controllers) using built-in animation. they provide history control for free without any programming effort. navigation controllers automatically handle back button functionality.

At their simplest level, navigation controllers manage View Controller stacks.

Every navigation controller owns a Root View Controller. This controller forms the base of the stack.

Add new items onto the navigation stack by pushing a new controller with pushviewcontroller: animated :.

Typically, modal controllers are used to pick data such as contacts from the address book or photos from the library, but you can use modal controllers in any setting where it makes sense to perform a task that lies outside the normal scope of the active View Controller.

Any View Controller or navigation controller can present a modal controller:
[Self presentmodalviewcontroller: [[[infoviewcontroller alloc] init] autorelease] animated: Yes];

Subviews display onscreen in order, always from back to front. this works something like a stack of animation cells -- those transparent sheets used to create cartoons. only the parts of the sheets that have been painted show through. the clear parts allow any visual elements behind that sheet to be seen. views too can have clear and painted parts, and can be layered to build a complex presentation.

The uilayoutcontainerview is never used directly by developer. It's part of the SDK's uiwindow implementation.

Nsstringformcgrect (acgrect) converts a cgrect structure to a formatted string. This function makes it easy to log a view's frame when you're debugging.

Cgrectfromstring (astring) recovers a rectangle from its string representation. it proves useful when you 've stored a view's frame as string in user defaults and want to convert that string back to a cgrect.

Cgrectinset (arect, xinset, yinset) enables you want to create a smaller or larger rectangle that's centered on the same point as the source rectangle. use a positive inset for smaller rectangles, negative for larger ones.

Cgrectintersectsrect (rect1, rect2) lets you know whether rectangle structures interset. Use this function to know when two rectangular onscreen objects overlap.

Cgrectcreatedictionaryrepresentation (arect) transforms a rectangle structure into a standard cfdictionaryref, also know (via the magic of toll-free bridging) as (nsdictionary *) instances. transform the dictionary back to a rectangle by using cgrectmakewithdictionaryrepresentation (adict, arect ).

Cgrectzero is a rectangle constant located at (0, 0) whose width and height are zero. you can use this constant when you're required to create a frame but are still unsure what that frame size of location will be at the time of creation.

Views live in two worlds. their frames are defined in the coordinate system of their parents. their bounds and subviews are defined in their own coordinate system. to convert a point from another view into your own coordinate system, use convertpoint: From View:, for example:
Mypoint = [myview convertpoint: somepoint fromview: otherview];

The iPhone SDK does not yet CT you to move a view by changing its frame. instead, it provides you with a way to update a view's position. the preferred way to do this is by setting the view's center.

Change a view's size onscreen by adjusting either its frame or its bounds.
When a view's size changes, the view itself updates live onscreen.

Uiview animations work as blocks, that is, a complete transaction that progresses at once. start the block by issuing beginanimations: Context :. end the block with commitanimations. send these class methods to uiview and not to individual views.
Beginanimations: Context -- marks the start of the animation block.
Setanimationcurve -- defines the way the animation accelerates and decelerates.
Setanimationduration -- specifies the length of the animation, in seconds.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.