티스토리 툴바

블로그 이미지
세상에 귀찮은 일은 없습니다. 해야할 일이 있을 뿐이지요. 사조

카테고리

분류 전체보기 (50)
MFC (2)
리눅스/C (0)
안드로이드 (33)
사조 (1)
아이폰 (7)
Total15,043
Today12
Yesterday50

id path = @"url"; //image주소

NSURL *url = [NSURL URLWithString:path];

NSData *data = [NSData dataWithContentsOfURL:url];

UIImage *img = [[UIImage alloc] initWithData:data]; 

UIImageView *imageView = [[UIImageView alloc] initWithImage:img];

저작자 표시 비영리 변경 금지
Posted by 사조
TAG UIImage

<UIActionSheetDelegate> 추가

//해당 ActionSheet를 생성하고자 하는 곳에 다음의 코드를 삽입

UIActionSheet *menu = [[UIActionSheet alloc

                                           initWithTitle@"이것은 타이틀이지." 

                                           delegate:self

                                           cancelButtonTitle:@"Cancel"

                                           destructiveButtonTitle:@"Main"

                                           otherButtonTitles:@"테스트1", @"테스트2" nil];

                    [menu showInView:self.view];



//UIActionSheet 안의 버튼이 클릭 되었을 때 CallBack
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex

{

printf("User Pressed Button %d\n", buttonIndex);

[actionSheet release];

} 

저작자 표시 비영리 변경 금지

'아이폰' 카테고리의 다른 글

[iOS] UIActionSheet 사용법  (0) 2011/12/15
[iOS]서버체크  (0) 2011/12/02
[iOS] Array 정렬하기  (0) 2011/11/29
[IOS-cocos2d] Sprite opacity 값  (0) 2011/10/06
[IOS] cocos2d Scene 전환  (0) 2011/08/11
[IOS] Error : profile doesn't match application identifier  (0) 2011/07/12
Posted by 사조

[iOS]서버체크

아이폰 / 2011/12/02 17:29
(BOOL)connectedToNetwork  {
// Create zero addy
    struct sockaddr_in zeroAddress;
    bzero(&zeroAddress, sizeof(zeroAddress));
    zeroAddress.sin_len = sizeof(zeroAddress);
    zeroAddress.sin_family = AF_INET;
    // Recover reachability flags
    SCNetworkReachabilityRef defaultRouteReachability = SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr*)&zeroAddress);
    SCNetworkReachabilityFlags flags;
    BOOL didRetrieveFlags = SCNetworkReachabilityGetFlags(defaultRouteReachability, &flags);
    CFRelease(defaultRouteReachability);
    if (!didRetrieveFlags)
    {
        NSLog(@"Error. Could not recover network reachability flags");
        return 0;
    }
    BOOL isReachable = flags & kSCNetworkFlagsReachable;
    BOOL needsConnection = flags & kSCNetworkFlagsConnectionRequired;

(
BOOL) pingServer
{

    NSURL *url = [NSURL URLWithString:@"http://some-url-that-has-to-work/"];
   
NSURLRequest *request = [NSMutableURLRequest requestWithURL:url];
   
NSHTTPURLResponse *response = nil;
   
[NSURLConnection sendSynchronousRequest:request
        returningResponse
:&response error:NULL];
   
return (response != nil);
}
저작자 표시 비영리 변경 금지

'아이폰' 카테고리의 다른 글

[iOS] UIActionSheet 사용법  (0) 2011/12/15
[iOS]서버체크  (0) 2011/12/02
[iOS] Array 정렬하기  (0) 2011/11/29
[IOS-cocos2d] Sprite opacity 값  (0) 2011/10/06
[IOS] cocos2d Scene 전환  (0) 2011/08/11
[IOS] Error : profile doesn't match application identifier  (0) 2011/07/12
Posted by 사조

최근에 달린 댓글

최근에 받은 트랙백

글 보관함