'iPhone'에 해당되는 글 170건

  1. 2013.04.22 [objc] 絵文字を含んでるNSStringの数え
  2. 2013.04.20 [objc] UIButton 색 바꾸기. change color
  3. 2013.04.20 [objc] UIActionSheet
  4. 2013.04.20 [objc] UINavigationContorller 설정 버튼
  5. 2013.04.19 [objc] 정규표현식 전화번호 체크
  6. 2013.04.18 [objc] NSNull check
  7. 2013.04.18 [objc] 커스텀 경고창 만들기. alert
  8. 2013.04.18 [objc] UITextAlignment depracated in iOS6
  9. 2013.04.18 [objc] UITextView
  10. 2013.04.18 [objc] splash 이미지 크기, 이름
  11. 2013.04.17 [objc]UINavigationBar : 네비게이션 버튼 색 바꾸기
  12. 2013.04.17 [objc]NSString CFStringRef 캐스팅
  13. 2013.04.17 [objc]NSString 문자열에서 숫자만 뽑아내기
  14. 2013.04.16 [objc][tutorial] UITextField 키보드 내리기
  15. 2013.04.14 [objc] 커스텀 테이블뷰 셀, custom UITableViewCell
  16. 2013.04.10 [objc][error pattern] [UISwipeGestureRecognizer retain]: message sent to deallocated instance ...
  17. 2013.04.09 [objc] Soft Keyboard 2
  18. 2013.04.08 [objc] NSURLError 1
  19. 2013.03.27 [objc] facebook 3
  20. 2013.03.25 [objc] 전화, openURL 2
  21. 2013.03.21 [objc] Scheme, DEBUG mode / Release mode 2
  22. 2013.03.07 [objc] JSON framework 1
  23. 2013.03.05 [objc] 네비게이션 컨트롤러, UINavigationController 1
  24. 2013.03.04 [objc] NSString 8
  25. 2013.02.28 [objc] 단말정보, os 2
  26. 2013.02.14 [objc] UITextField 입력값 제한
  27. 2013.02.13 [objc] 화면비율고 레이아웃. layout
  28. 2013.02.06 [objc] File, Document directory
  29. 2013.02.04 [objc] 텍스트필드 : 리턴키 누르면 키보드 숨기기, UITextField, returnKey, Keyboard
  30. 2013.02.01 [objc] debug. EXC_BAD_ACCESS




- (NSInteger)countStrWithEmoji:(NSString*)str {

    

    __block NSInteger cnt = 0;

    

    [str enumerateSubstringsInRange:NSMakeRange(0, [str length]) options:NSStringEnumerationByComposedCharacterSequences usingBlock:

     ^(NSString* substring, NSRange substringRange, NSRange enclosingRange, BOOL* stop){

         

         const unichar high = [substring characterAtIndex: 0];

         

         // surrogate pair

         if (0xd800 <= high && high <= 0xdbff) {

             cnt++;

             

             // not surrogate pair

         } else {

             cnt++;

         }

     }];

    

    return cnt;

}



Posted by tenn
,



    UIButton *delBtn = self.delBtn;

    [delBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];

    delBtn.backgroundColor = [UIColor redColor];

    delBtn.layer.backgroundColor = [UIColor redColor].CGColor;

    delBtn.layer.borderColor = [UIColor blackColor].CGColor;

    delBtn.layer.borderWidth = 1.0f;

    delBtn.layer.cornerRadius = 10.0f;


http://stackoverflow.com/questions/2808888/is-it-even-possible-to-change-a-uibuttons-background-color






Posted by tenn
,

[objc] UIActionSheet

iPhone 2013. 4. 20. 14:36






UIActionSheet * actionSheet = [[UIActionSheet alloc]initWithTitle:@"Setting" delegate:self

                                                    cancelButtonTitle:@"Cancel"

                                               destructiveButtonTitle:@"Delete"

                                                    otherButtonTitles:@"1",@"2", nil];

    

[actionSheet showInView:self.view];




Posted by tenn
,



UIBarButtonItem *btn = ..


btn.title = @"\u2699"; 

UIFont *f1 = [UIFont fontWithName:@"Helvetica" size:24.0]; 

NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys:f1, UITextAttributeFont, nil]; 

[btn setTitleTextAttributes:dict forState:UIControlStateNormal];



http://stackoverflow.com/questions/9755154/ios-uibarbuttonitem-identifier-option-to-create-settings-cogwheel-button





Posted by tenn
,

0으로 시작하고

9-10자리

숫자


1. 숫자만 추출하여

2. 정규표현식으로 체크


    NSString *phoneNumber = @"03-3200-2222";

    

    phoneNumber = [[phoneNumber componentsSeparatedByCharactersInSet:[[NSCharacterSet decimalDigitCharacterSet]invertedSet]]componentsJoinedByString:@""];

    

    NSString *someRegexp = @"^0\\d{9,10}$";

    NSPredicate *myTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", someRegexp];

    

    if ([myTest evaluateWithObject: phoneNumber]){

        //Matches

        NSLog(@"it is a phone number");

    }else{

        NSLog(@"it is NOT a phone number");

    }






Posted by tenn
,

[objc] NSNull check

iPhone 2013. 4. 18. 20:38

JSON에서 받은 값에서 NULL의 값은

NSNull로 돌아오는데.

그 체크를 하려면



if
(title == (id)[NSNull null] || title.length == 0 ) title = @"Something";




http://stackoverflow.com/questions/968792/what-is-the-right-way-to-check-for-a-null-string-in-objective-c






Posted by tenn
,


UIView : 배경. 경고창이외를 만질 때, 이벤트를 무시하기 위한

UIView : 경고창

UITextView : 메세지표시를 위한

UIButton : 경고창 버튼


1. 배경(UIView)에 경고창(UIView)을 붙여주고.

2. UITextView에 메세지를 넣고

3. UIView에 UITextView를 붙임

4. UITextView의 높이를 컨텐츠 높이로 재조정

5. UIView의 높이를 UITextView의 높이에 따라 재조정

6. 취향에 따라 버튼을 붙여준다.


Posted by tenn
,

UITextAlignment -> NSTextAlignment

Posted by tenn
,

[objc] UITextView

iPhone 2013. 4. 18. 11:11


내용뷰의 높이

UIView인스턴스.contentSize.height

Posted by tenn
,



아이폰5(긴- 레티나)

이름:  Default-568h@2x

크기 :  640px x 1136px


아이폰4, 4s(종전 레티나)

이름 : default@2x.png 

크기 : 640px x 960px


비레티나

이름 : default.png 

크기 : 320px X 480 px

Posted by tenn
,


UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithTitle:@"Done"

                                                                    style:UIBarButtonItemStyleDone target:self action:@selector(tapButton)];

    [rightButton setTintColor:[UIColor colorWithRed:0.0/255.0 green:200.0/255.0 blue:0.0/255.0 alpha:1.0]];

    self.navigationItem.rightBarButtonItem = rightButton;

Posted by tenn
,


NSString < -> CFStringRef



NSString *nsStr = (__bridge NSString *)cfStrRef;


http://stackoverflow.com/questions/640367/how-to-convert-cfstringref-to-nsstring




Posted by tenn
,



문자열에서 숫자만 뽑아내기


 NSString *newString = [[origString componentsSeparatedByCharactersInSet:

            [[NSCharacterSet decimalDigitCharacterSet] invertedSet]] 

            componentsJoinedByString:@""];



http://stackoverflow.com/questions/1129521/remove-all-but-numbers-from-nsstring

Posted by tenn
,

보호되어 있는 글입니다.
내용을 보시려면 비밀번호를 입력하세요.


1. xib 에서 보여질 Cell의 레이아웃 생성


2. UITableViewCell을 만들어서 xib의 셀에 커스텀클래스로 연결


3. 쓰여질 테이블뷰에서 

셀 == nil일때 

xib에서 불러서 cell에 집어넣음



Posted by tenn
,

ARC 사용.

iOS6은 멀쩡. 

iOS5에서만 일어났음.


스토리보드의 UIViewController에 붙여놨던 SwiptGestureRecognizer가 
메모리 부족으로 인해 dealloc되어 크래쉬 되었었다.(고 한다)



Posted by tenn
,

[objc] Soft Keyboard

iPhone 2013. 4. 9. 19:19


Posted by tenn
,

[objc] NSURLError

iPhone 2013. 4. 8. 13:45



NSURLErrorUnknown = -1, NSURLErrorCancelled = -999, NSURLErrorBadURL = -1000, NSURLErrorTimedOut = -1001, NSURLErrorUnsupportedURL = -1002, NSURLErrorCannotFindHost = -1003, NSURLErrorCannotConnectToHost = -1004, NSURLErrorDataLengthExceedsMaximum = -1103, NSURLErrorNetworkConnectionLost = -1005, NSURLErrorDNSLookupFailed = -1006, NSURLErrorHTTPTooManyRedirects = -1007, NSURLErrorResourceUnavailable = -1008, NSURLErrorNotConnectedToInternet = -1009, NSURLErrorRedirectToNonExistentLocation = -1010, NSURLErrorBadServerResponse = -1011, NSURLErrorUserCancelledAuthentication = -1012, NSURLErrorUserAuthenticationRequired = -1013, NSURLErrorZeroByteResource = -1014, NSURLErrorCannotDecodeRawData = -1015, NSURLErrorCannotDecodeContentData = -1016, NSURLErrorCannotParseResponse = -1017, NSURLErrorInternationalRoamingOff = -1018, NSURLErrorCallIsActive = -1019, NSURLErrorDataNotAllowed = -1020, NSURLErrorRequestBodyStreamExhausted = -1021, NSURLErrorFileDoesNotExist = -1100, NSURLErrorFileIsDirectory = -1101, NSURLErrorNoPermissionsToReadFile = -1102, NSURLErrorSecureConnectionFailed = -1200, NSURLErrorServerCertificateHasBadDate = -1201, NSURLErrorServerCertificateUntrusted = -1202, NSURLErrorServerCertificateHasUnknownRoot = -1203, NSURLErrorServerCertificateNotYetValid = -1204, NSURLErrorClientCertificateRejected = -1205, NSURLErrorClientCertificateRequired = -1206, NSURLErrorCannotLoadFromNetwork = -2000, NSURLErrorCannotCreateFile = -3000, NSURLErrorCannotOpenFile = -3001, NSURLErrorCannotCloseFile = -3002, NSURLErrorCannotWriteToFile = -3003, NSURLErrorCannotRemoveFile = -3004, NSURLErrorCannotMoveFile = -3005, NSURLErrorDownloadDecodingFailedMidStream = -3006, NSURLErrorDownloadDecodingFailedToComplete = -3007


https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Constants/Reference/reference.html

Posted by tenn
,

[objc] facebook

iPhone 2013. 3. 27. 14:21


facebook dev page

http://developers.facebook.com/docs/

Posted by tenn
,

[objc] 전화, openURL

iPhone 2013. 3. 25. 16:35


Posted by tenn
,


Posted by tenn
,

[objc] JSON framework

iPhone 2013. 3. 7. 15:06


Posted by tenn
,


Posted by tenn
,

[objc] NSString

iPhone 2013. 3. 4. 11:37

***set NSString with TextField's text

NSString *name = [[NSString allocinitWithString:textField.text];


***edit NSString

NSString msg = [NSString stringWithFormat:@"%@", name];


***connect NSStirngs

NSString *str1 = @"aaaa";

NSString *str2 = @"bbbb";

NSString *str3 = [NSString stringWithFormat:@"%@%@",str1,str2];



***indexOf

#define contains(str1, str2) ([str1 rangeOfString: str2 ].location != NSNotFound)

if(contains(self.display.text@".")){

        return;

    }


***trim

[self.tagTF.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]



***Casting

NSString  int

int num = [@"123" intValue];


int  NSString

NSString *str = [NSString stringWithFormat:@"%d", 123];


double  NSString

NSString *str = [NSString stringWithFormat:@"%f", 42.195];


toString

NSString *str = (NSString*)object;


1byte와 2byte문자가 섞인 문자열의 길이 알아내기


NSString *string = @"あいa";

int length = [string length];

int count = 0;

for (int i=0; i<length; i++) {

NSString *str = [string substringWithRange:NSMakeRange(i, 1)];

count+= [str lengthOfBytesUsingEncoding:[str smallestEncoding]];

}


ref : http://starpl.com/jidolstar/10659760



Posted by tenn
,

[objc] 단말정보, os

iPhone 2013. 2. 28. 18:36


Posted by tenn
,




//UITextFieldDelegate 선언후...




- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {

    

    if(textField.text.length + string.length - range.length > 15){


        return NO;

    }

    

    

    return YES;

}





Posted by tenn
,

아이폰5의 길쭉한 화면과 예전의 화면을 볼수 있는 토글 버튼(스토리보드 하단에 위치)이 스토리 보드에 있는데,


하나 맞추고 다시 다른 것을 맞추면 먼저 맞춰져있던것이 다 헝클어지는 것이었다.


그럴 땐, size inspector(오른쪽 메뉴 끝에서 두번째) 잘 맞추면 된다.

Posted by tenn
,




Document 디렉토리 비우기 (서브디렉토리 & 파일 지우기)



   NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);

    

   NSArray *fileList = [filemgr subpathsAtPath:[paths objectAtIndex:0]];

        

   for(int i=0; i < fileList.count; i++){

            

            NSString *subPath = [fileList objectAtIndex:i];

            

            NSLog(@"%d : %@", i, subPath);

            

            NSString *currentPath = [NSString stringWithFormat:@"%@/%@", [paths objectAtIndex:0], subPath];


            [filemgr removeItemAtPath:currentPath error:NULL];

   }





파일 생성일


            NSDictionary* fileAttribs = [[NSFileManager defaultManager] attributesOfItemAtPath:path error:nil];

            NSDate *result = [fileAttribs fileCreationDate]; //or fileModificationDate



http://stackoverflow.com/questions/3642013/objective-c-get-file-creation-date








Posted by tenn
,



//동작확인

// xcode 4.6

// ipod touch 5th


.h

//delegate

@interface ViewController : UIViewController <UITextFieldDelegate>



.m

- (void)viewDidLoad

{

    [super viewDidLoad];

    tf.delegate = self;

}


- (BOOL)textFieldShouldReturn:(UITextField *)textField{

    if(textField == tf){

        [textField resignFirstResponder];

    }

    return YES;

}





Posted by tenn
,







EXC_BAD_ACCESS → ZombieObject 설정


EditSchme > 해당스킴 > Diagnostics > Memory Management

     Enable Zombie Objects



참고 : http://xinics.tistory.com/66


Posted by tenn
,