2014년 4월 5일 토요일

iphone UIActionSheet example


1. .m 상단에 tag 정의

#define TAG_ACTION_SHEET 11111

2. .h 에 delegate 추가

@interface SignUpViewController : UIViewController <UIActionSheetDelegate> 

3. .m 특정 버튼 클릭시
- (IBAction)clickPhoto:(id)sender

{
UIActionSheet *popup = [[UIActionSheet allocinitWithTitle:@"" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:
                            @"camera",
                            @"album",
                            nil];
     popup.tag = TAG_ACTION_SHEET;

    [popup showInView:[UIApplication sharedApplication].keyWindow];
}

4. .m event 처리부분

- (void)actionSheet:(UIActionSheet *)popup clickedButtonAtIndex:(NSInteger)buttonIndex {
    
    switch (popup.tag) {
        case TAG_ACTION_SHEET: {
            switch (buttonIndex) {
                case 0:
                    NSLog("camera");
                    break;
                case 1:
                    NSLog("album");
                    break;
                default:
                    break;
            }
            break;
        }
        default:
            break;
    }
}

댓글 1개:

  1. In this manner my partner Wesley Virgin's report launches with this SHOCKING AND CONTROVERSIAL video.

    Wesley was in the army-and soon after leaving-he revealed hidden, "MIND CONTROL" secrets that the government and others used to get everything they want.

    THESE are the exact same tactics tons of famous people (especially those who "come out of nothing") and elite business people used to become rich and famous.

    You probably know that you use less than 10% of your brain.

    That's really because the majority of your brain's power is UNCONSCIOUS.

    Maybe this conversation has even occurred INSIDE your own mind... as it did in my good friend Wesley Virgin's mind 7 years back, while driving a non-registered, beat-up trash bucket of a car with a suspended driver's license and $3.20 on his bank card.

    "I'm very fed up with going through life check to check! When will I become successful?"

    You've taken part in those types of thoughts, right?

    Your very own success story is going to happen. Go and take a leap of faith in YOURSELF.

    WATCH WESLEY SPEAK NOW

    답글삭제