아이폰어플개발정보2010. 10. 30. 02:34
[아이폰 앱 개발] Animation: Move an object

Animation: Move an object

Show something moving across the screen. Note: this type of animation is "fire and forget" -- you cannot obtain any information about the objects during animation (such as current position). If you need this information, you will want to animate manually using a Timer and adjusting the x&y coordinates as necessary.
CABasicAnimation *theAnimation; theAnimation=[CABasicAnimation animationWithKeyPath:@"transform.translation.x"]; theAnimation.duration=1; theAnimation.repeatCount=2; theAnimation.autoreverses=YES; theAnimation.fromValue=[NSNumber numberWithFloat:0]; theAnimation.toValue=[NSNumber numberWithFloat:-60]; [view.layer addAnimation:theAnimation forKey:@"animateLayer"];
http://www.iphoneexamples.com/
Posted by 오늘마감

댓글을 달아 주세요

아이폰어플개발정보2010. 10. 15. 15:36
[아이폰 앱 개발] Throwing and rethrowing an exception

Listing 1  Throwing and rethrowing an exception


@try {

    // ...

    if (someError) {

        NSException *theException = [NSException exceptionWithName:MyAppException reason:@"Some error just occurred!" userInfo:nil];

        @throw theException;

    }

}

@catch (NSException *exception) {

    if ([[exception name] isEqualToString:MyAppException]) {

        NSRunAlertPanel(@"Error Panel", @"%@", @"OK", nil, nil,

                localException);

    }

    @throw; // rethrow the exception

}

@finally {

    [self cleanUp];

}

In this code the exception (exception) is thrown again at the end of the local handler, allowing an encompassing exception handler to take some additional action. Figure 1 illustrates the flow of program control between nested exception handlers created with the @catch directive.

Figure 1  Control flow with nested exception handlers—using directives

An exception raised within Method 3's domain causes execution to jump to its local exception handler. In a typical application, this exception handler queries the exception object to determine the nature of the exception. The local handler may handle exception types that it recognizes and then may rethrow the exception object to pass notification of the exception to the handler nested above it—that is, the handler in Method 2. However, before the next outer exception handler is invoked, the code in the @finally block associated with the local exception handler is executed. (This has implications for memory management, as discussed in “Exception Handling and Memory Management .”)

An exception that is rethrown appears to the next higher handler just as if the initial exception had been raised within its own exception handling domain. Method 2's exception handler again may handle the exception and may rethrow the exception to Method 1's exception handler; Method 1’s handler does not receive the rethrown exception until Method 2’s @finally block completes its task. Finally, Method 1’s handler rethrows the exception. Because there is no exception handling domain above Method 1, the exception passes to the uncaught exception handler (see “Uncaught Exceptions”).

Nested Exception Handlers With Exception Macros

You program should use the exception-handling macros if it must be compatible with versions of the operating system prior to Mac OS X v10.3. If you are using the exception-handling macros, the code equivalent to that in Listing 1 would look something like Listing 2.

Listing 2  Raising and re-raising an exception


NS_DURING

    ...

    if (someError) {

        NSException *theException = [NSException exceptionWithName:MyAppException reason:@"Some error just occurred!" userInfo:nil];

        [theException raise];

    }

    [self cleanUp];

NS_HANDLER

    if ([[localException name] isEqualToString:MyAppException]) {

        NSRunAlertPanel(@"Error Panel", @"%@", @"OK", nil, nil,

                localException);

    }

    [self cleanUp];

    [localException raise]; /* Re-raise the exception. */

NS_ENDHANDLER

In this code the exception (exception or localException) is raised again at the end of the local handler, allowing an encompassing exception handler to take some additional action. Figure 2 illustrates the use of nested exception handlers, and is discussed in the text that follows.

Figure 2  Control flow with nested exception handlers—using macros

An exception raised within Method 3’s domain causes execution to jump to its local exception handler. In a typical application, this exception handler checks the object localException to determine the nature of the exception. For exception types that it recognizes, the local handler responds and then may send raise to localException to pass notification of the exception to the handler above, the handler in Method 2. (An exception that is re-raised appears to the next higher handler just as if the initial exception had been raised within its own exception handling domain.) Method 2’s exception handler does the same and then re-raises the exception to Method 1’s handler. Finally, Method 1’s handler re-raises the exception. Since there is no exception handling domain above Method 1, the exception is transferred to the uncaught exception handler (see “Uncaught Exceptions”).

Posted by 오늘마감

댓글을 달아 주세요

아이폰어플개발정보2010. 10. 12. 05:53
Animation: Move an object

Animation: Move an object

Show something moving across the screen. Note: this type of animation is "fire and forget" -- you cannot obtain any information about the objects during animation (such as current position). If you need this information, you will want to animate manually using a Timer and adjusting the x&y coordinates as necessary.
CABasicAnimation *theAnimation; theAnimation=[CABasicAnimation animationWithKeyPath:@"transform.translation.x"]; theAnimation.duration=1; theAnimation.repeatCount=2; theAnimation.autoreverses=YES; theAnimation.fromValue=[NSNumber numberWithFloat:0]; theAnimation.toValue=[NSNumber numberWithFloat:-60]; [view.layer addAnimation:theAnimation forKey:@"animateLayer"];
http://www.iphoneexamples.com/

'아이폰어플개발정보' 카테고리의 다른 글

Application Frame얻기  (0) 2010.10.12
A basic UIWebView  (0) 2010.10.12
Animation: Move an object  (0) 2010.10.12
Info button  (0) 2010.10.12
UIView 높이 폭변경  (0) 2010.10.12
user와 인터렉션하는 alert 샘플  (0) 2010.10.12
Posted by 오늘마감

댓글을 달아 주세요

아이폰어플개발정보2010. 10. 12. 05:25
Convert an Image (UIImage) to Grayscale

http://iphonedevelopertips.com/

Convert an Image (UIImage) to Grayscale

Posted by 오늘마감

댓글을 달아 주세요

아이폰어플개발정보2010. 10. 12. 05:23
Adding an Activity Indicator (Spinner) to Navigation Bar

Adding an Activity Indicator (Spinner) to Navigation Bar

Posted by 오늘마감

댓글을 달아 주세요

오브젝트C2010. 10. 12. 04:48
[objective-c] Throwing and rethrowing an exception

Listing 1  Throwing and rethrowing an exception


@try {

 // ...

 if (someError) {

 NSException *theException = [NSException exceptionWithName:MyAppException reason:@"Some error just occurred!" userInfo:nil];

 @throw theException;

 }

}

@catch (NSException *exception) {

 if ([[exception name] isEqualToString:MyAppException]) {

 NSRunAlertPanel(@"Error Panel", @"%@", @"OK", nil, nil,

 localException);

 }

 @throw; // rethrow the exception

}

@finally {

 [self cleanUp];

}

In this code the exception (exception) is thrown again at the end of the local handler, allowing an encompassing exception handler to take some additional action. Figure 1 illustrates the flow of program control between nested exception handlers created with the @catch directive.

Figure 1  Control flow with nested exception handlers—using directives

An exception raised within Method 3's domain causes execution to jump to its local exception handler. In a typical application, this exception handler queries the exception object to determine the nature of the exception. The local handler may handle exception types that it recognizes and then may rethrow the exception object to pass notification of the exception to the handler nested above it—that is, the handler in Method 2. However, before the next outer exception handler is invoked, the code in the @finally block associated with the local exception handler is executed. (This has implications for memory management, as discussed in “Exception Handling and Memory Management .”)

An exception that is rethrown appears to the next higher handler just as if the initial exception had been raised within its own exception handling domain. Method 2's exception handler again may handle the exception and may rethrow the exception to Method 1's exception handler; Method 1’s handler does not receive the rethrown exception until Method 2’s @finally block completes its task. Finally, Method 1’s handler rethrows the exception. Because there is no exception handling domain above Method 1, the exception passes to the uncaught exception handler (see “Uncaught Exceptions”).

Nested Exception Handlers With Exception Macros

You program should use the exception-handling macros if it must be compatible with versions of the operating system prior to Mac OS X v10.3. If you are using the exception-handling macros, the code equivalent to that in Listing 1 would look something like Listing 2.

Listing 2  Raising and re-raising an exception


NS_DURING

 ...

 if (someError) {

 NSException *theException = [NSException exceptionWithName:MyAppException reason:@"Some error just occurred!" userInfo:nil];

 [theException raise];

 }

 [self cleanUp];

NS_HANDLER

 if ([[localException name] isEqualToString:MyAppException]) {

 NSRunAlertPanel(@"Error Panel", @"%@", @"OK", nil, nil,

 localException);

 }

 [self cleanUp];

 [localException raise]; /* Re-raise the exception. */

NS_ENDHANDLER

In this code the exception (exception or localException) is raised again at the end of the local handler, allowing an encompassing exception handler to take some additional action. Figure 2 illustrates the use of nested exception handlers, and is discussed in the text that follows.

Figure 2  Control flow with nested exception handlers—using macros

An exception raised within Method 3’s domain causes execution to jump to its local exception handler. In a typical application, this exception handler checks the object localException to determine the nature of the exception. For exception types that it recognizes, the local handler responds and then may send raise to localException to pass notification of the exception to the handler above, the handler in Method 2. (An exception that is re-raised appears to the next higher handler just as if the initial exception had been raised within its own exception handling domain.) Method 2’s exception handler does the same and then re-raises the exception to Method 1’s handler. Finally, Method 1’s handler re-raises the exception. Since there is no exception handling domain above Method 1, the exception is transferred to the uncaught exception handler (see “Uncaught Exceptions”).

Posted by 오늘마감

댓글을 달아 주세요

아이폰어플개발정보2010. 10. 5. 23:52
Convert an Image (UIImage) to Grayscale

http://iphonedevelopertips.com/

Convert an Image (UIImage) to Grayscale



출처 : http://blog.naver.com/PostList.nhn?blogId=philipousys¤tPage=45
Posted by 오늘마감

댓글을 달아 주세요

아이폰어플개발정보2010. 10. 5. 23:52
Adding an Activity Indicator (Spinner) to Navigation Bar

Adding an Activity Indicator (Spinner) to Navigation Bar



출처 : http://blog.naver.com/PostList.nhn?blogId=philipousys¤tPage=43
Posted by 오늘마감

댓글을 달아 주세요