2014년 4월 7일 월요일

[iOS] UIAlertView 사용하기

UIAlertView 간단한 사용 예제


UIAlertView는 UIAlertVIewDelegate 프로토콜을 따른다.
(헤더파일에 <UIAlertViewDelegate>를 포함시키지 않아도 작동된다.)
#1
    UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Question"
                                                       message:@"Do you want to build a snowman?"
                                                      delegate:self
                                             cancelButtonTitle:@"NO"    /* nil 로 지정할 경우 cancel button 없음 */
                                             otherButtonTitles:@"YES", nil];

    // alert창을 띄우는 method는 show이다.
    [alert show];



#2
// UIAlertView의 delegate method이다
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    // OK 버튼을 눌렀을 때 버튼Index가 1로 들어감
    if (buttonIndex == 1) {
        NSLog(@"Clicked YES");
    }
    else {
       
    }
}


예제 실행 화면



* 만약 하나의 ViewController 안에 alertview를 여러 개 사용해야 한다면
다음과 같이 각각의 alertview에 tag를 지정해주어 식별해야 한다.

alertA.tag = 101;
alertB.tag = 102;

...

// UIAlertView의 delegate method
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
   if ( alertView.tag == 101 ) {
       if (buttonIndex == 1) {
            NSLog(@"Alert A - YES");
        }
    }
    else if ( alertView.tag == 102 ) {   
       if (buttonIndex == 1) {
            NSLog(@"Alert B - YES");
        }
    }
    
}


<Result>

alertA 호출 + YES버튼 터치 시 :
  2014-04-08 15:48:50.902 AlertViewTest[3098:60b] Alert A - YES

alertB 호출 + YES버튼 터치 시 :
  2014-04-08 15:53:22.981 AlertViewTest[3106:60b] Alert B - YES

2014년 4월 2일 수요일

구글 대량메일 발신자 가이드라인!


내 업무용 메일이 스팸이라니!! 말도안돼

단체 메일을 보낼 때 문제 없이 수신자에게 전달해주는 방법을 설명해 주고 있다.
생각보다 챙겨야 할 사항이 많음.

https://support.google.com/mail/answer/81126?hl=ko&ref_topic=3404235


DKIM까지는 안되더라도 최소한 SPF레코드 정도는 등록해주어야 유령취급받지 않을 수 있다.

2014년 3월 22일 토요일

GOODSMILE 1/8 Nao - Mabinogi









피규어 정리중..
팔려가기 전에 사진이나 남겨둠.