'분류 전체보기'에 해당되는 글 333건

  1. 2014.01.13 [objc] gesuture, tap, 눌렀을때 이벤트
  2. 2014.01.10 [objc] UIView, animation, 애니메이션이 끝난후 다른 애니메이션
  3. 2014.01.08 [objc] UITableView, 특정셀로 스크롤 시키기
  4. 2014.01.06 [objc] NSDate를 인수로 할 때, 제한을 두지 않고 싶을 때,
  5. 2014.01.06 [objc] sleep, CurrentRunLoop
  6. 2014.01.03 [objc] status bar
  7. 2013.12.28 [objc] 앨범에서 마지막으로 찍은 사진 가져오기
  8. 2013.12.27 AVCaptureSession, AVCaptureDevice, BAD ACCESS, crash
  9. 2013.12.25 [objc] NSMutableArray, 순서
  10. 2013.12.20 [Python] 연습코딩. gui, alert
  11. 2013.12.20 [python] GUI
  12. 2013.12.18 [Python] 연습코딩, thread, timer, input, try
  13. 2013.12.17 [python] 문자연산
  14. 2013.12.15 [vim] copy and paste, 복붙
  15. 2013.12.15 [python] 파일이름 일괄 변경, 파라메터
  16. 2013.12.15 [python] hello world, OSX
  17. 2013.12.12 [objc] 아이폰 디바이스 체크 (iPhone5S체크에)
  18. 2013.12.12 [objc] 일정시간후 block 실행
  19. 2013.12.11 linker command failed with exit code 1
  20. 2013.12.06 [objc] NSArray 순서 랜덤하게 바꾸기
  21. 2013.12.04 [xcode] framework추가하는데 엄한 곳에서 계속 에러가 날때
  22. 2013.12.03 [objc] UIWebView, 길게탭 이벤트 죽이기
  23. 2013.12.02 [objc] xcode5, iOS5 프로젝트 만들면 에러-
  24. 2013.11.28 [objc] 화면이동 참고 자료
  25. 2013.11.21 [objc] UITabBar setHidden, 영역이 남는 문제
  26. 2013.11.20 [objc] OHAttributedLabel, auto link 추가 삭제
  27. 2013.11.19 [objc] block, 큐, 병렬처리
  28. 2013.11.18 [objc] 인터넷 커넥션 체크
  29. 2013.11.14 [objc][Err] AFURLConnectionOperation.operationDidStart, Bad Access
  30. 2013.11.13 [etc] 안드로이드 기기, 위치 추적


TouchDown 잡아와서 터치지점의 CGPoint로 이벤트 핸들링을 할 일이 생겼는데..


UITapGesture에서 TouchUp이벤트를 주는 건 알겠는데

TouchDown을 하려고 보니까 뭔가 귀찮은게 있는 듯.

안드로이드에서는 쉬웠던거 같은데...

UIGesture로 하려고 하면 복잡하듯 해서,

touchesBegan에서 잡아서 하니까 된다...


http://stackoverflow.com/questions/3176304/get-touch-location-from-touchesbegan-and-other-game-questions



Posted by tenn
,




http://stackoverflow.com/questions/9235872/running-an-animation-one-after-the-other-fails

Posted by tenn
,



            NSIndexPath* ip = [NSIndexPath indexPathForRow:indexPath.row inSection:indexPath.section];

            [tableView scrollToRowAtIndexPath:ip atScrollPosition:UITableViewScrollPositionTop animated:YES];




http://stackoverflow.com/questions/2156614/how-to-start-uitableview-on-the-last-cell

Posted by tenn
,




[NSDate distantFuture];

먼미래에...

최대치의 느낌으로 쓰자.


http://qiita.com/happy_ryo/items/db116859f105d8a2e178

Posted by tenn
,


어떤 이벤트/처리를 기다릴때,

sleep하면 처리자체가 멈추므로.

현재의 메인스레드 이외에는 멈추면 안됨.


그럴때, while문 사이에..


[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]];





Posted by tenn
,

[objc] status bar

iPhone 2014. 1. 3. 16:48


스테이터스바 표시


if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {

    // iOS 7

    [self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];

} else {

    // iOS 6

    [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];

}


- (BOOL)prefersStatusBarHidden {

    return YES;

}



http://stackoverflow.com/questions/12661031/how-to-hide-a-status-bar-in-ios






스테이터스바 텍스트 컬러


 [self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];



-(UIStatusBarStyle)preferredStatusBarStyle{ 

    return UIStatusBarStyleLightContent; 

}


http://stackoverflow.com/questions/17678881/how-to-change-status-bar-text-color-in-ios-7

Posted by tenn
,






    ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];

    

    // Enumerate just the photos and videos group by using ALAssetsGroupSavedPhotos.

    [library enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos usingBlock:^(ALAssetsGroup *group, BOOL *stop) {

        

        // Within the group enumeration block, filter to enumerate just photos.

        [group setAssetsFilter:[ALAssetsFilter allPhotos]];

        

        // Chooses the photo at the last index

        [group enumerateAssetsAtIndexes:[NSIndexSet indexSetWithIndex:([group numberOfAssets] - 1)] options:0 usingBlock:^(ALAsset *alAsset, NSUInteger index, BOOL *innerStop) {

            

            // The end of the enumeration is signaled by asset == nil.

            if (alAsset) {

                ALAssetRepresentation *representation = [alAsset defaultRepresentation];

                UIImage *latestPhoto = [UIImage imageWithCGImage:[representation fullScreenImage]];

                [latestPhoto resizeImageToWidth:50];

                

                if (latestPhoto){

                    [self.imgBtn setBackgroundImage:latestPhoto forState:UIControlStateNormal];

                    [self.imgBtn setBackgroundImage:latestPhoto forState:UIControlStateHighlighted];

                }

            }

        }];

    } failureBlock: ^(NSError *error) {

    }];



http://stackoverflow.com/questions/8867496/get-last-image-from-photos-app

Posted by tenn
,

카메라 관련의 주의점


AVCaptureDevice observer를 추가할 때

다른 인스턴스라고 하더라도 같이 영향을 받는 듯.

계속 크래시 하길래, 조사했더니

AVCaptureDevice에 NSKeyValueObservingOptionNew를 등록하고는 해제해주지 않은 채로,

새로운 뷰컨트롤러에서 카메라를 쓰려고 할때 같은 옵저버를 등록하려고 하자.

BAD ACCESS에러로 크래쉬.


뷰가 사라지는 지점에서 해제해주자, 현상은 없어졌다.

Posted by tenn
,


    

NSArray *array = [NSArray arrayWithObjects:@"1",@"2",@"3", nil];

    

    NSMutableArray *dataArray = [NSMutableArray arrayWithArray:array];

    [dataArray addObject:@"4"];

    

    NSArray *array2 = [NSArray arrayWithObjects:@"5",@"6",@"7", nil];

    

    [dataArray addObjectsFromArray:array2];

    

    

    for(NSString *str in dataArray){

        NSLog(@"%@", str);

    }




결과


2013-12-25 14:38:54.899 TestPrj[2030:70b] 1

2013-12-25 14:38:54.901 TestPrj[2030:70b] 2

2013-12-25 14:38:54.901 TestPrj[2030:70b] 3

2013-12-25 14:38:54.902 TestPrj[2030:70b] 4

2013-12-25 14:38:54.902 TestPrj[2030:70b] 5

2013-12-25 14:38:54.902 TestPrj[2030:70b] 6

2013-12-25 14:38:54.903 TestPrj[2030:70b] 7



Posted by tenn
,



mport tkinter.messagebox



def hello():

        tkinter.messagebox.showinfo('hello','hello')


var = tkinter.messagebox.askyesno('select','')


tkinter.messagebox.showinfo('your select', 'You selected '+str(var))


hello()



Posted by tenn
,

[python] GUI

Python 2013. 12. 20. 01:28



*MessageBox


import tkinter.messagebox

tkinter.messagebox.showinfo('','')






* ConfirmBox


import tkinter.messagebox

var = tkinter.messagebox.askquestion('title','question')

//tkinter.messagebox.askyesno('','')




http://stackoverflow.com/questions/1052420/tkinter-message-box


Posted by tenn
,


import threading, time


def hello():

        i = 0

        while i < 5:

                i = i + 1

                print("hello "+str(i))

                time.sleep(1.0)



inp = input("input time? ")

try:

        numInp = int(inp)

        print("input value : " + inp)

except ValueError:

        print("input value is not valid. \n default : 1")

        numInp = 1.0

t = threading.Timer(numInp, hello)

t.start()





Posted by tenn
,

[python] 문자연산

Python 2013. 12. 17. 01:22



<<캐스팅>>

* 숫자 -> 문자열

str(10)

*문자열 -> 숫자

int('10')

http://stackoverflow.com/questions/961632/converting-integer-to-string-in-python



문자연산

http://creaplz.tistory.com/26

Posted by tenn
,

[vim] copy and paste, 복붙

etc 2013. 12. 15. 09:44

우리의 영원한 친구

복사 붙붙붙



**한줄

dd  : 한줄잘라내기

p   :  붙여넣기


yy : 한줄 복사

p


** 여러줄

v -> v : 영역 지정


y  : 복사

p


d : 잘라내기

p




참고로  : undo는 u





Posted by tenn
,



from os import rename, listdir, sys


files = listdir('.')


if len(sys.argv) is 1:

        print("input target string and replace string..")

        exit(0)

if len(sys.argv) is 2:

        print("input replace string..")

        exit(0)


targetStr = sys.argv[1]

replaceStr = sys.argv[2]


for name in files:

#       if name.startswith('b'):

        if name.startswith(targetStr):

                newname = name.replace(targetStr,replaceStr)

                rename(name,newname)

                print(name + ' -> ' + newname)





파일이름 일괄변경

http://www.appilogue.kr/2844289


파라메터

http://mwultong.blogspot.com/2007/01/python-sysargv-command-line-argument.html

Posted by tenn
,

[python] hello world, OSX

Python 2013. 12. 15. 02:21

먼저 파이썬 버전을 정한다.


2.x버전은 OSX에 이미 깔려있다.

-> 터미널에서 Python -V로 확인

3.x버전을 사용하려면, 새로 다운로드받아서 깔아야한다.

http://www.python.org/download/


두버전간의 문법도 틀림.

2.x를 유지하는 이유는 3.x버전에서는 하위호환성이 없기 때문이란다.



helloworld.py

#!/usr/bin/python


#print "hello world"   <- ver2 style    <- Pythone의 주석문은 #

print("hello world")  <- ver3 




python3 helloworld.py

Posted by tenn
,

- (NSString *) platform

{

    size_t size;

    sysctlbyname("hw.machine", NULL, &size, NULL, 0);

    char *machine = malloc(size);

    sysctlbyname("hw.machine", machine, &size, NULL, 0);

    NSString *platform = [NSString stringWithUTF8String:machine];

    free(machine);

    return platform;

}



http://iphonedevsdk.vanillaforums.com/forum/iphone-sdk-development/88107-getting-the-model-of-the-device.html


Posted by tenn
,




dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 10 * NSEC_PER_SEC), dispatch_get_current_queue(), ^{
    ...
});




http://stackoverflow.com/questions/4139219/how-do-you-trigger-a-block-after-a-delay-like-performselectorwithobjectafter

Posted by tenn
,

오늘의 0.5를 허공에 날려보낸...

linker command failed with exit code 1

!!!



Posted by tenn
,

셔플!


http://stackoverflow.com/questions/56648/whats-the-best-way-to-shuffle-an-nsmutablearray

Posted by tenn
,



프레임워크를 추가했는데 

추가한 프레임워크가 아닌 다른곳에서 계속 에러가 난다.

프로젝트의 복사본으로 여러차례 테스트해본결과,

프로젝트안의 프로젝트에서 프레임워크로 쓰는 xxx.a파일이 생성되어있지 않은것을 확인.

컴파일로 xxx.a파일을 생성해서 link binary framework의 빨간색을 다 없애자 문제가 해결됨.


-> 해결안됨.

프로젝트 파일의 변경을 조사한 결과

FRAMEWORK_SEARCH_PATHS에서


-                                       "\"$(SRCROOT)/FacebookSDK\"",

+                                       "\\\\\\\"$(SRCROOT)/FacebookSDK\\\\\\\"",

가 되어있는 것을 발견.

원래대로 돌려주니까,빌드 성공.

xcode의 버그인듯?


Posted by tenn
,

- (void)webViewDidFinishLoad:(UIWebView *)webView{

    // 링크 길게 누르면 나오는 메뉴를 안나오게

    [self.webview stringByEvaluatingJavaScriptFromString:@"document.body.style.webkitTouchCallout='none';"];

    // 길게 눌러서 선택 안되게

    [self.webview stringByEvaluatingJavaScriptFromString:@"document.documentElement.style.webkitUserSelect='none';"];

    

}

Posted by tenn
,

xcode5, iOS5


iOS5에서만 정상적으로 작동해서, 

움직임을 확인하려고, 프로젝트를 만들려고 했더니,

빌드타겟을 iOS5로 하고 실행시키면,

스토리보드 못찾겠다고 에러가 난다.


일단, 실행되게 하려면,

http://need-bee.com/b/2013/08/could-not-find-a-storyboard-in-xcode-5-for-ios-5-0/



근데, 실행은 되는데 스토리보드에 있는 콤포넌트들을 못읽어오네?..

그냥 코드로 만들어 붙여서 테스트 했다.



Posted by tenn
,



화면 이동시에 불려지는 메소드

http://iphone-dev.g.hatena.ne.jp/tokorom/20100110/1263150473

Posted by tenn
,



요롷고롬 하면 됨.


    CGRect rect = /* FULL SCREEN */;

    [[self.tabBarController.view.subviews objectAtIndex:0] setFrame:rect];



    [self.tabBarController.tabBar setHidden:YES];

    [[self.tabBarController.view.subviews objectAtIndex:0] setFrame:self.tabBarController.view.frame];







http://stackoverflow.com/questions/2426248/uitabbar-leaves-a-white-rectangle-when-hidden

Posted by tenn
,




// 디폴트 링크 전부 삭제

[self.ohlabel setAutomaticallyAddLinksForType:0];



//링크만 체크 (숫자로 전화걸리는 링크는 삭제하고 싶을때)

[self.ohlabel setAutomaticallyAddLinksForType:NSTextCheckingTypeLink];






참고링크


**문자열로부터 URL, 전화번호를 취득.

http://www.sirochro.com/note/objc-nsdatadetector-using/


** 링크 기능 죽이기

https://github.com/AliSoftware/OHAttributedLabel/issues/112

Posted by tenn
,


** Global Queue

    dispatch_queue_t syncQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT0);

    dispatch_async(syncQueue, ^{

});


** Main Queue


dispatch_async(dispatch_get_main_queue(), ^{

        });



** private Queue


dispatch_queue_t queue;
queue = dispatch_queue_create("com.example.MyQueue", NULL);




************


Simple block sample

int x = 123;
int y = 456;
 
// Block declaration and assignment
void (^aBlock)(int) = ^(int z) {
    printf("%d %d %d\n", x, y, z);
};
 
// Execute the block
aBlock(789);   // prints: 123 456 789

https://developer.apple.com/library/ios/documentation/General/Conceptual/ConcurrencyProgrammingGuide/OperationQueues/OperationQueues.html

************

...Block:(void(^)(int b, intc))block{

     block(1, 2);

}

Posted by tenn
,

#import "Reachability.h"


+ (BOOL)isConnectedToInternet

{

    Reachability *reachability = [Reachability reachabilityForInternetConnection];

    return NotReachable != [reachability currentReachabilityStatus];

}

Posted by tenn
,

bundler identifier에 이상한 문자가 들어가면


AFURLConnectionOperation에서 Bad Access로 기동이 안되고,

어플이 강제종료 되는 현상이 있다.


XCode5

iOS5, iOS6에서 현상 있음.

iOS7에서는 문제없음.

Posted by tenn
,



https://www.google.com/android/devicemanager


계정에 등록되어 있는 기기의 위치를 알수 있다.

벨소리도 울린다!

Posted by tenn
,