반응형

사운드

IPHONE 2013. 7. 4. 11:15
반응형

#import <AudioToolbox/AudioToolbox.h>


- (void)playClick
{
    NSString *sndpath = [[NSBundle mainBundle] pathForResource:@"click" ofType:@"wav"];
    CFURLRef baseURL = (CFURLRef)CFBridgingRetain([NSURL fileURLWithPath:sndpath]);
   
    SystemSoundID sysSound;
    AudioServicesCreateSystemSoundID(baseURL, &sysSound);
    CFRelease(baseURL);
   
    AudioServicesAddSystemSoundCompletion(sysSound, NULL, NULL, _systemSoundDidComplete, NULL);

    AudioServicesPlaySystemSound(sysSound);
}


void _systemSoundDidComplete(SystemSoundID ssID, void *clientData)
{
    AudioServicesDisposeSystemSoundID(ssID);
}

반응형

'IPHONE' 카테고리의 다른 글

아카이브에 저장하고 불러 오기 샘플 코드.  (0) 2013.09.04
Local Notification  (0) 2013.07.10
UIActionSheet 사용하기.  (0) 2013.05.30
UIViewAlert 사용하기.  (0) 2013.05.30
네비게이션바, 툴바 보이게하기.  (0) 2013.05.20
Posted by 컴스터
,

UIActionSheet 사용하기.

IPHONE 2013. 5. 30. 11:32
반응형

UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:nil
                                                       delegate:self
                                              cancelButtonTitle:@"취소"
                                         destructiveButtonTitle:nil
                                              otherButtonTitles:@"액션1", @"액션2", nil];
   
    [sheet showInView:self.view];



// *********** ActionSheet 버튼 클릭시 실행하는 메소드. ***************************************

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
    if (buttonIndex == actionSheet.cancelButtonIndex)
    {
        NSLog(@"취소 버튼 클릭");
    }
}

반응형

'IPHONE' 카테고리의 다른 글

Local Notification  (0) 2013.07.10
사운드  (0) 2013.07.04
UIViewAlert 사용하기.  (0) 2013.05.30
네비게이션바, 툴바 보이게하기.  (0) 2013.05.20
Simulator 에 앱경로 알아 보기.  (0) 2013.05.06
Posted by 컴스터
,

UIViewAlert 사용하기.

IPHONE 2013. 5. 30. 09:25
반응형

UIAlertView *alert = [[UIAlertView alloc] init];
    alert.delegate = self;
    alert.title = @"타이틀입니다.";
    alert.message = @"메세지를 적습니다. ^^";
    [alert addButtonWithTitle:@"아니오"];
    [alert addButtonWithTitle:@"예"];
    alert.cancelButtonIndex = 0;
    [alert show];


// ********************* 버튼 선택에 따른 처리 *******************************************

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    // 버튼이 취소버튼인지 비교.
    if (buttonIndex != alertView.cancelButtonIndex)
    {
        // 예 버튼이 눌렸을때.
        UIAlertView *alert = [[UIAlertView alloc] init];
        alert.title = @"참! 잘했어요.";
        alert.message = @"예를 눌렀군요.";
        [alert addButtonWithTitle:@"OK"];
        [alert show];       
    }
   
}

반응형
Posted by 컴스터
,
반응형
- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];

    // 네비게이션바 보이기.
    [self.navigationController setNavigationBarHidden:NO animated:YES];

    // 툴바 보이기.
    [self.navigationController setToolbarHidden:NO animated:YES];
}


반응형
Posted by 컴스터
,
반응형

    NSLog(@"%@", NSHomeDirectory());


출력된 값을 복사하여 finder 에서 오른쪽 마우스 버튼을 클릭하여 폴더로 이동에 붙여넣어서 이동하면 된다.

반응형
Posted by 컴스터
,
반응형

.h 파일.

@property (strong, nonatomic) IBOutlet UITextField *textField;



.m 파일.

-(IBAction)backgroundTouched:(id)sender

{

    [_textField resignFirstResponder];

}


.xib파일에서.

1. File's Owner와 First Responder 아이콘 아래에 View 를 선택한후 오른쪽 화면에서 


Identity Inspector(option + command + 3)를 선택한후 Class 설정을 UIView에서 UIControl로 변경한다.


2. 오른쪽 Connections Inspector(option + command + 6)화면에서 Touch Down 이벤트의 오른편 


원을 클릭하여 File's Owner 아이콘으로 드래그하여 backgroundTouched 메서드와 연결한다.

반응형
Posted by 컴스터
,
반응형

텍스트필드 이벤트중 Did End On Exit 이벤트에 다음과 같이 연결시킨다.


-(IBAction)textFieldReturn:(id)sender

{

    [sender resignFirstResponder];

}



반응형
Posted by 컴스터
,
반응형

#import <AudioToolbox/AudioToolbox.h>


-(IBAction)StartVibrate

{

     AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);

}

반응형
Posted by 컴스터
,
반응형

-(IBAction)call:(id)sender

{

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://000-0000-0000"]];

}

-(IBAction)sms:(id)sender

{

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms://000-0000-0000"]];


반응형
Posted by 컴스터
,
반응형

- (void)viewDidLoad

{

    [super viewDidLoad];

// Do any additional setup after loading the view, typically from a nib.

    // IBOutlet UIImageView *aniview1; 헤더 파일에 선언. IB에 연결.

    aniview1.animationImages = [NSArray arrayWithObjects:[UIImage imageNamed:@"smile01.png"],

                                [UIImage imageNamed:@"smile02.png"],

                                [UIImage imageNamed:@"smile03.png"], nil];

    // 초단위로 이미지 변경 시간을 정한다.

    aniview1.animationDuration = 1.00;

    // 반복횟수를 정하는 숫자이며 0 무한반복이고 1,2,3,... 횟수만큼 반복 이미지가 사라진다.

    aniview1.animationRepeatCount = 0;

    

    [aniview1 startAnimating];

    [self.view addSubview:aniview1];

}


반응형
Posted by 컴스터
,


반응형