출처 : http://androidkr.blogspot.kr/2012/10/open-source-chart-for-ios.html


iOS 앱 개발 시 Chart 그리는데 유용한 open source 프로젝트 들.


'Mobile > iPhone / Xcode' 카테고리의 다른 글

[Xcode] XCode VS AppCode  (0) 2013.11.27
[iOS] iOS Simulator 위치  (0) 2012.03.06
[iOS] About View Controllers  (0) 2012.03.06
[iOS] About Events in iOS  (0) 2012.03.04
[iOS] json parser for Objective-c  (0) 2012.03.04
posted by 뚱2
버전마다 다르긴 하지만 우선 올려둔다.
그리고 기본적으로 숨김 파일처리 되어서 숨김파일을 해제해야 한다.
위젯을 받아서 숨김파일을 볼수 있게 한다 (http://www.apple.com/downloads/dashboard/developer/hiddenfiles.html )

 


해당위치를 보면 iOS설치 앱이 보입니다.

 

'Mobile > iPhone / Xcode' 카테고리의 다른 글

[Xcode] XCode VS AppCode  (0) 2013.11.27
[iOS] Open Source Chart for iOS  (0) 2013.01.12
[iOS] About View Controllers  (0) 2012.03.06
[iOS] About Events in iOS  (0) 2012.03.04
[iOS] json parser for Objective-c  (0) 2012.03.04
posted by 뚱2
출처 : iOS document

View controllers are a vital link between an app’s data and its visual appearance. Whenever an iOS app displays a user interface, the displayed content is managed by a view controller or a group of view controllers coordinating with each other. Therefore, view controllers provide the skeletal framework on which you build your apps.

iOS provides many built-in view controller classes to support standard user interface pieces, such as navigation and tab bars. As part of developing an app, you also implement one or more custom controllers to display the content specific to your app. 

'Mobile > iPhone / Xcode' 카테고리의 다른 글

[iOS] Open Source Chart for iOS  (0) 2013.01.12
[iOS] iOS Simulator 위치  (0) 2012.03.06
[iOS] About Events in iOS  (0) 2012.03.04
[iOS] json parser for Objective-c  (0) 2012.03.04
[Xcode4] C, C++ 프로젝트 생성  (0) 2011.10.22
posted by 뚱2

출처 : 출처 : iOS document

Events are objects sent to an application to inform it of user actions. In iOS, events can take many forms: multitouch events, motion events—for example, from device accelerometers—and events for controlling multimedia. (This last type of event is known as a remote-control event because it originates from a headset or other external accessory.)



posted by 뚱2
posted by 뚱2
이번에 iOS5 GM Seed를 다운 받았는데 설치하는 방법을 또 잊어버렸다. ㅡㅡ;

* 맥에서 ipsw 파일로 업데이트 방법
1. 최신 펌웨어 파일을 받는다 (보통 .dmg 파일이다.)
2. 원하는 위치에 파일을 푼다.
3. 버전에 맞는 iTune를 설치한다.
4. 백업을 한다.
5. ALT + Restore 버튼을 클릭한다. (Windows는 Shift + Restore)
6. 저장된 ipsw 파일을 선택한다.
7. 그다음은 시키는데로 한다. 
posted by 뚱2
출처 : https://github.com/leah/PullToRefresh

소스 분석하면서 직접 구현해 본것.
나중에 사용하기 위해서 저장

// viewcontroller.h
@interface ViewController : UIViewController <UITableViewDatasource, UITableViewDelegate>
{
    NSMutableArray *data;
    BOOL           bLoading;
    BOOL           bDragging;
    
    UIView *headerView;
    UIActivityIndicatorView *activity;
    UILabel *label;
    UIImageView *imageView;
    NSString *strBeginDragging;
    NSString *strEndDragging;
    NSString *strLoading;
}

@property (nonatomic, retain) NSMutableArray *data;
@property (nonatomic, assign, getter = isLoading ) BOOL bLoading;
@property (nonatomic, assign, getter = isDraggin ) BOOL bDragging;
@property (nonatomic, retain) UIActivityIndicatorView *activity;
@property (nonatomic, retain) UIView *headerView;
@property (nonatomic, retain) UILabel *label;
@property (nonatomic, retain) UIImageView *imageView;
@property (nonatomic, retain) NSString *strBeginDragging;
@property (nonatomic, retain) NSString *strEndDragging;
@property (nonatomic, retain) NSString *strLoading;

- (void)createHeader;

@end
 
// viewcontroller.m
#define REFRESH_HEADER_HEIGHT 60.0f

@implementation ViewController

@synthesize data;
@synthesize bLoading, bDragging;
@synthesize activity, headerView;
@synthesize label;
@synthesize imageView;
@synthesize strBeginDragging, strEndDragging, strLoading;

#pragma mark - animation
- (void)refresh {
    // This is just a demo. Override this method with your custom reload action.
    // Don't forget to call stopLoading at the end.
    [self performSelector:@selector(stopLoading) withObject:nil afterDelay:2.0];
}

- (void)startLoading {
    self.bLoading = true;
    
    // Show the header
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.3];
    UITableView *tableView = (UITableView *)self.view;
    tableView.contentInset = UIEdgeInsetsMake(REFRESH_HEADER_HEIGHT, 0, 0, 0);
    
    label.text = strLoading;
    [activity startAnimating];
    
    
    [UIView commitAnimations];  
    
    // Refresh action!
    [self refresh];
}

- (void)stopLoading {
    self.bLoading = false;
    
    // Hide the header
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDuration:0.3];
    [UIView setAnimationDidStopSelector:@selector(stopLoadingComplete:finished:context:)];
    UITableView *tableView = (UITableView *)self.view;
    tableView.contentInset = UIEdgeInsetsZero;
    //[refreshArrow layer].transform = CATransform3DMakeRotation(M_PI * 2, 0, 0, 1);

    
    [self.activity stopAnimating];
    
    [UIView commitAnimations];
    

}

- (void)stopLoadingComplete:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {
    // Reset the header
    label.text = strBeginDragging;
    label.text = strBeginDragging;
    [imageView layer].transform = CATransform3DMakeRotation(M_PI * 2, 0, 0, 1);
}


#pragma mark - scroll events
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView 
{
    if ( self.isLoading ) return;
    
    self.bDragging = true;

}

- (void)scrollViewDidScroll:(UIScrollView *)scrollView 
{
    if ( self.isLoading ) 
    {
        //NSLog(@"isLoading : %f", scrollView.contentOffset.y );        
    }
    else if ( self.isDraggin && scrollView.contentOffset.y < 0 ) 
    {
        //NSLog(@"self.isDragging ; %f", scrollView.contentOffset.y ); 
        [UIView beginAnimations:nil context:NULL];
        if (scrollView.contentOffset.y < -REFRESH_HEADER_HEIGHT) {
            // User is scrolling above the header
            label.text = strEndDragging;
            [imageView layer].transform = CATransform3DMakeRotation(M_PI, 0, 0, 1);
        } else { // User is scrolling somewhere within the header
            label.text = strBeginDragging;
            [imageView layer].transform = CATransform3DMakeRotation(M_PI * 2, 0, 0, 1);
        }
        [UIView commitAnimations];        
    }
    
}

- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate 
{  
    if ( self.isLoading ) return;    
    self.bDragging = false;
    
    NSLog(@"scrollView.contentOffset.y: %f <= %f", scrollView.contentOffset.y, -REFRESH_HEADER_HEIGHT);
    if (scrollView.contentOffset.y <= -REFRESH_HEADER_HEIGHT) {
        // Released above the header
        [self startLoading];
    } 
}

#pragma mark - dealloc
- (void)createHeader
{
    strBeginDragging = [[NSString alloc] initWithString:@"새글을 불러오시겠습니까?"];
    strEndDragging   = [[NSString alloc] initWithString:@"놓으면 새글을 불러옵니다."];
    strLoading       = [[NSString alloc] initWithString:@"로딩중입니다..."];
    
    
    // view
    headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0-REFRESH_HEADER_HEIGHT, 320, REFRESH_HEADER_HEIGHT)];
    
    // activityindicator
    activity = [[UIActivityIndicatorView alloc] init];
    activity.center = CGPointMake(320.f/2, REFRESH_HEADER_HEIGHT/2);
    activity.hidesWhenStopped = true;
    activity.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray;
    
    // label
    label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, REFRESH_HEADER_HEIGHT)];
    label.text = strBeginDragging;
    label.backgroundColor = [UIColor clearColor];
    label.font = [UIFont boldSystemFontOfSize:12.0];
    label.textAlignment = UITextAlignmentCenter;
    
    // imageView
    UIImage *image = [UIImage imageNamed:@"arrow.png"];
    imageView = [[UIImageView alloc] initWithImage:image];
    imageView.frame = CGRectMake(0
                                 , (REFRESH_HEADER_HEIGHT-image.size.height) /2
                                 , image.size.width
                                 , image.size.height);
    imageView.backgroundColor = [UIColor clearColor];
    
    [headerView addSubview:activity];
    [headerView addSubview:label];
    [headerView addSubview:imageView];
    
    [self.view addSubview:headerView];
}


- (void)dealloc
{
    [strLoading release];
    [strBeginDragging release];
    [strEndDragging release];
    [imageView release];
    [label release];
    [activity release];
    [headerView release];
    [data release];
    
    [super dealloc];
}

#pragma mark - table datasource
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
    }
    
    cell.textLabel.text = [data objectAtIndex:indexPath.row];
    
    return cell;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [data count];
}

#pragma mark - memorywarning


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
    self.data = [NSMutableArray arrayWithObjects:
                 @"Pull down to refresh", nil];
    
    [self createHeader];
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
}

- (void)viewWillDisappear:(BOOL)animated
{
	[super viewWillDisappear:animated];
}

- (void)viewDidDisappear:(BOOL)animated
{
	[super viewDidDisappear:animated];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}

@end

 
posted by 뚱2
참고 : http://vimeo.com/8718829

혼자 구현해보다가 몇가지 문제를 해결하지 못하고 성질버려서 구굴링한  결과 동영상으로 튜토리얼까지
만든 사이트를 찾았습니다.

위 사이트는 오른쪽, 왼쪽 말풍선 두개를 사용하는데 전 왼쪽용 말풍선을 도저히 구하지 못해서 결국
이미지를 반전시켰습니다. 

나중에 사용할 요량으로 우선 저장

//MainViewController.h
@interface MainViewController : UITableViewController
{
    NSMutableArray *arrSms;
}

@property (nonatomic, retain) NSMutableArray *arrSms;

- (void)initResource;

@end


//MainViewController.m 
#import "MainViewController.h"

@implementation MainViewController

@synthesize arrSms;

#pragma mark-
#pragma mark resource

- (void)dealloc
{
    [arrSms release];
    
    
    [super dealloc];
}

- (void)initResource
{
    // Custom initialization
    self.tableView.frame = [[UIScreen mainScreen] applicationFrame];

    
    arrSms = [[NSMutableArray alloc] initWithObjects:@"안녕하세요"
              , @"네 안녕이요"
              , @"이건 조금 긴 글 입니다. ^^"
              , @"이건 더 긴글 입니다. 하하하하 "
              , @"아이폰도 UI를 이쁘게 만들려면 결국 노가다가 많군요."
              , @"디자인에 잼병인 저로서는 정말 좌절을 느끼는 중입니다. 이 쉬운 이미지를 찾기 위해서 하루종일 뒤졌어요"
              , @"결국 반대이미지를 찾지 못해서 결국 프로그램에서 이미지 뒤집는 일까지 있어요 그냥 반대 이미지 사용하면 쉬운데...."
              , nil];    
}

#pragma mark-

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if ( self ) {
        [self initResource];
    }
    
    return self;
}

- (id)initWithStyle:(UITableViewStyle)style
{
    self = [super initWithStyle:style];
    if (self) {
        [self initResource];
    }
    return self;
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];

    // Uncomment the following line to preserve selection between presentations.
    // self.clearsSelectionOnViewWillAppear = NO;
 
    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    // self.navigationItem.rightBarButtonItem = self.editButtonItem;
    
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    
//    self.tableView.backgroundColor = [UIColor colorWithRed:219.0/255.0 green:226.0/255.0 blue:237.0/255.0 alpha:1.0];
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
    self.arrSms         = nil;
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
}

- (void)viewDidDisappear:(BOOL)animated
{
    [super viewDidDisappear:animated];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    // Return the number of sections.
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    // Return the number of rows in the section.
    return [arrSms count];
}

#define TAG_IMAGEVIEW   1
#define TAG_LABEL       2
#define TAG_MESSAGE     3

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    
    UIImageView *imageView = nil;
    UILabel *label = nil;
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        
        imageView = [[UIImageView alloc] init ];
        imageView.tag = TAG_IMAGEVIEW;
        label = [[UILabel alloc] init];
        label.tag = TAG_LABEL;
        label.backgroundColor = [UIColor clearColor];
        label.numberOfLines = 0;
        label.lineBreakMode = UILineBreakModeWordWrap;
        label.font = [UIFont systemFontOfSize:14.0];
        
        UIView *message = [[UIView alloc] initWithFrame:CGRectMake(0, 0, cell.frame.size.width, cell.frame.size.height) ];
        message.tag = TAG_MESSAGE;
        
     
        [message addSubview:imageView];
        [message addSubview:label];
        
        message.autoresizingMask = UIViewAutoresizingFlexibleWidth;
        
        
        [cell.contentView addSubview:message];
        
        
        [imageView release];
        [label release];
        [message release];
    }
    else 
    {
        imageView = (UIImageView *)[[cell.contentView viewWithTag:TAG_MESSAGE] viewWithTag:TAG_IMAGEVIEW];
        label     = (UILabel *)[[cell.contentView viewWithTag:TAG_MESSAGE] viewWithTag:TAG_LABEL];
    }
    
    // Configure the cell...
    
    NSString* text = [arrSms objectAtIndex:indexPath.row];
    CGSize size = [text sizeWithFont:[UIFont systemFontOfSize:14.0] 
                   constrainedToSize:CGSizeMake(220.0f, 480.0f) 
                       lineBreakMode:UILineBreakModeWordWrap];
    
    UIImage *image = nil;
    if ( indexPath.row%2 == 0 ) {
        imageView.frame = CGRectMake(320.0f-(size.width+35.0f), 2.0f, size.width+35.0f, size.height+24.0f);
        imageView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
        image = [[UIImage imageNamed:@"Balloon_1@2x.png"] stretchableImageWithLeftCapWidth:28.0f 
                                                                              topCapHeight:24.0f];
        
        label.frame = CGRectMake(307.0f-(size.width+5.0f), 10.0f, size.width+8.0f, size.height+5.0f);
        label.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
    }
    else {
        imageView.frame = CGRectMake(0, 2.0f, size.width+35.0f, size.height+24.0f);
        imageView.autoresizingMask = UIViewAutoresizingFlexibleRightMargin;
        UIImage *tempImage = [UIImage imageNamed:@"Balloon_2@2x.png"];
        UIImage *covertImage = [UIImage imageWithCGImage:(CGImageRef)tempImage.CGImage 
                                                   scale:1.0f 
                                             orientation:UIImageOrientationUpMirrored];
        image = [covertImage stretchableImageWithLeftCapWidth:28.0f 
                                                 topCapHeight:24.0f];
        
        label.frame = CGRectMake(25.0f,10.0f, size.width+5.0f, size.height);
        label.autoresizingMask = UIViewAutoresizingFlexibleRightMargin;
    }
    imageView.image = image;
    label.text = text;
    
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSString* text = [arrSms objectAtIndex:indexPath.row];
    CGSize size = [text sizeWithFont:[UIFont systemFontOfSize:14.0] 
                   constrainedToSize:CGSizeMake(220.0f, 480.0f) 
                       lineBreakMode:UILineBreakModeWordWrap];
    return size.height+28.0f;
}


#pragma mark - Table view delegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    // Navigation logic may go here. Create and push another view controller.
    /*
     <#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil];
     // ...
     // Pass the selected object to the new view controller.
     [self.navigationController pushViewController:detailViewController animated:YES];
     [detailViewController release];
     */
}

@end


posted by 뚱2
하나의 App은 Xcode의 하나의 프로젝트에 맵핑이 된다고 할 수 있습니다.
그런데 보통 프로그램을 만드는 프로젝트(*1)는 하나의 프로그램으로 끝날수도 있지만 규모가 커지면 여러가지 프로그램이
묶여서 하나의 프로젝트로 됩니다.
이럴때 관리를 위해서 논리적으로 묶어줄 필요가 있는데 
XCode에서는 Workspace, Visual Studio에서는 solution, Eclipse에서는 Workspace로 묶어 줄수 있습니다.

새로운 워크스페이스를 생성합니다.

워크스페이스 이름과 저장할 위치를 지정합니다.


워크스페이스를 생성하면 프로젝트가 없는 빈 워크스페이스가 생성됩니다.


워크스페이스에 새로운 프로젝트를 생성 할 수도 있고 기존 프로젝트를 추가 할 수도 있습니다.


기존 프로젝트를 추가한 모습니다.


결국 워크스페이스는 여러개의 단위프로젝트를 논리적으로 묶어주는 역활을 합니다.
빈 워크스페이스를 만들면 


XXX.xcworkspace가 만들어 지는데 이 파일을 열어보면 아래와 같이 폴더안에 파일이 있고 XML로 정보를 가지고 있는걸
알수 있습니다.


개발에 필요한 자체 라이브러리나 유틸등을 워크스페이스로 묶어주면 좀더 편하고 쉽게 개발 할 수 있습니다.



*1) 여기서 말하는 프로젝트는 업무 즉 개발 프로젝트를 말합니다.

 
posted by 뚱2
제가 정리 해볼까 하다가 너무 정리가 잘된 외국 블로그가 있어서 링크합니다.

출처 : http://blog.carbonfive.com/2011/04/04/using-open-source-static-libraries-in-xcode-4/ 
posted by 뚱2
아이폰 Static Library를 사용하려고 찾다가 읽어보니 프로젝트 개발시

도움이 될것 같아 링크 걸어둡니다.

출처 : http://blog.jidolstar.com/749 
posted by 뚱2
프로그램을 개발하다보면은 중복되는 코드들이 생기게 됩니다.
그럴때 가장 쉽게 하는 방법은 기존 파일을 복사하는 방법입니다.
거기에 한단계 나아가면 자신만의 라이브러리를 만들게 됩니다.
iOS상에서 static library는 만들어 지는데 dynamic library를 어떻게 만들지 몰라서
찾아보니 보안상의 이유로 안된다는 군요.

출처 :http://stackoverflow.com/questions/4733847/can-create-dynamic-library-for-ios 
 
posted by 뚱2
출처 : ㅠㅠ 잊어버렸습니다.


인터넷에서 유니코드 한글 위치와 초성 중성 종성을 찾는 알고리즘을 찾았는데 브라우져를 꺼버렸네요 ㅠㅠ
암튼 위의 이미지를 참조해서 아이폰에서 사용할 요량으로 만들어 봤습니다.
알고리즘에 오타 문제가 있습니다.
초성부분에 int((strCode - 0xAC00) / 28 * 21) 이라고 했는데 "28*21" 부분을 "(28*21)" 괄호로 묶어줘야 합니다.
//ChosungUtil.h
#define HANGUL_START_CODE   0xAC00
#define HANGUL_END_CODE     0xD79F

@interface ChosungUtil : NSObject
{
    NSArray *chosung;
    NSArray *jungsung;
    NSArray *jongsung;
}

@property (nonatomic, retain) NSArray *chosung;
@property (nonatomic, retain) NSArray *jungsung;
@property (nonatomic, retain) NSArray *jongsung;

// 입력문자열를 초성과 비교해서 NSComparisonResult를 반환한다.
- (NSComparisonResult) compare:(NSString *)source withChoungString:(NSString *)search;
// 입력문자열을 초성으로 변환시킨다.
- (NSString*) stringChosung:(NSString *) source; 

@end

//ChosungUtil.m
#import "ChosungUtil.h"

@implementation ChosungUtil

@synthesize chosung, jungsung, jongsung;


- (NSComparisonResult) compare:(NSString *)source withChoungString:(NSString *)search
{
    return [[self stringChosung:source] compare:search];
}

- (NSString*) stringChosung:(NSString *) source
{
    NSMutableString *result = [NSMutableString string];
    
    for (NSUInteger i = 0; i < [source length]; i++) {
        NSInteger unicodeChar = [source characterAtIndex:i];
        
        // 한글인지 검색
        if ( HANGUL_START_CODE <= unicodeChar && unicodeChar <= HANGUL_END_CODE )
        {
            NSInteger chosungIndex  = (NSInteger)((unicodeChar - HANGUL_START_CODE) / (28*21));
            // 중성, 종성은 현재 필요없다.
            //            NSInteger jungsungIndex = (NSInteger)((unicodeChar - HANGUL_START_CODE) % (28*21) / 28);
            //            NSInteger jongsungIndex = (NSInteger)((unicodeChar - HANGUL_START_CODE) % 28);
            
            [result appendFormat:@"%@", [chosung objectAtIndex:chosungIndex]];
        }
        
    }
    
    return result;
}


-(id)init
{
    self = [super init];
    if ( self != nil )
    {
        // 초기화 
        chosung = [[NSArray arrayWithObjects:
                   @"ㄱ",@"ㄲ",@"ㄴ",@"ㄷ",@"ㄸ",@"ㄹ",@"ㅁ",
                   @"ㅂ",@"ㅃ",@"ㅅ",@"ㅆ",@"ㅇ",@"ㅈ",@"ㅉ",
                   @"ㅊ",@"ㅋ",@"ㅌ",@"ㅍ",@"ㅎ",nil] retain];

        jungsung = [[NSArray arrayWithObjects:
                     @"ㅏ",@"ㅐ",@"ㅑ",@"ㅒ",@"ㅓ",@"ㅔ",
                     @"ㅕ",@"ㅖ",@"ㅗ",@"ㅘ",@"ㅙ",@"ㅚ",
                     @"ㅛ",@"ㅜ",@"ㅝ",@"ㅞ",@"ㅟ",@"ㅠ",
                     @"ㅡ",@"ㅢ",@"ㅣ",nil] retain];
        jongsung = [[NSArray arrayWithObjects:
                     @"",@"ㄱ",@"ㄲ",@"ㄳ",@"ㄴ",@"ㄵ",@"ㄶ",
                     @"ㄷ",@"ㄹ",@"ㄺ",@"ㄻ",@"ㄼ",@"ㄽ",@"ㄾ",
                     @"ㄿ",@"ㅀ",@"ㅁ",@"ㅂ",@"ㅄ",@"ㅅ",@"ㅆ",
                     @"ㅇ",@"ㅈ",@"ㅊ",@"ㅋ",@" ㅌ",@"ㅍ",@"ㅎ",nil] retain];     
    }
    
    return self;
}


-(void)dealloc
{
    [chosung release];
    [jungsung release];
    [jongsung release];
    
    [super dealloc];
}

@end



//사용방법
-(IBAction)clickedButton:(id)sender 
{
    NSLog(@"%@", hangulField.text);
    
    ChosungUtil *util = [[[ChosungUtil alloc] init] autorelease];
    
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"변환결과" 
                                                    message:[util stringChosung:hangulField.text] 
                                                   delegate:self
                                           cancelButtonTitle:nil 
                                          otherButtonTitles:@"닫기", nil];
    [alert show];
    [alert release];
}




 
posted by 뚱2
// AddressBookModel.h
@interface AddressBookModel : NSObject
{
    NSMutableArray *aData;
}

@property (nonatomic, retain) NSMutableArray *aData;

+(AddressBookModel *)sharedInstance;
+(void)killInstance;
-(NSString*)print;
@end

// AddressBookModel.m
static AddressBookModel *_addressBookModelSingleInstance = nil;

@implementation AddressBookModel : NSObject

@synthesize aData;

-(NSString*)print
{
    NSMutableString *str = [NSMutableString string];
    for (int i = 0; i < [aData count]; i++ )
    {
        [str appendFormat:@"%@ ", [aData objectAtIndex:i]];
    }
    
    return str;
}

-(id)init
{
    self = [super init];
    
    if ( self != nil ) 
    {
        // 데이터 초기화 장소
        self.aData = [NSMutableArray arrayWithObjects:@"1", @"2", @"3", @"4", nil];
    }
    
    return self;
}

-(void)dealloc
{
    NSLog(@"AddressBookModel dealloc=>Ref Count=%d", [self retainCount]);
    
    [aData release];
    [super dealloc];
}

+(AddressBookModel *)sharedInstance
{    
    @synchronized(self) 
    {
        if ( _addressBookModelSingleInstance == nil ) 
        {
            _addressBookModelSingleInstance = [[AddressBookModel alloc] init];
            NSLog(@"AddressBookModel sharedInstance=>Ref Count=%d", [_addressBookModelSingleInstance retainCount]);
        }
    }
    
    return _addressBookModelSingleInstance;
}

+(void)killInstance
{
    @synchronized(self)
    {
       if (_addressBookModelSingleInstance != nil )
       {
            [_addressBookModelSingleInstance dealloc];
            _addressBookModelSingleInstance = nil;
       }     
    }
}

+(id)allocWithZone:(NSZone *)zone {
    @synchronized(self) 
    {
        if (_addressBookModelSingleInstance == nil) 
        {
            _addressBookModelSingleInstance = [super allocWithZone:zone];
            return _addressBookModelSingleInstance;
        }
    }
    return nil;
}

-(id)copyWithZone:(NSZone *)zone {
    return self;
}

-(id)retain {
    return self;
}

-(unsigned)retainCount {
    return UINT_MAX;
}

-(oneway void)release {
}

-(id)autorelease {
    return self;
}

@end

인터넷을 뒤지니까 대략 비슷한 소스코드가 쏟아집니다.
다른 문제는 다 해결됐는데 아무리 디버깅을 해봐도 dealloc 메소드가 호출되지 않네요.
결국 'killInstance'라는 클래스 메소드를 만들어서
내부에서 강제로 dealloc를 호출해주고 있습니다.
결국 문제는 싱글턴 만드는 것 까지는 좋은데 dealloc같이 메모리가 정확하게 해제되는 시점이 필요하다는 것입니다.
그렇지 않다면 메모리 해제시에 특정 작업을 처리 할 수가 없는 일이 발생하기 때문에 특정상황에서 애매해지는 일이 발생합니다.
전 억지로 killInstance라는 클래스 메소드를 만들었는데
혹 다른 방법을 알고있으시다면 알려주세요 ㅠㅠ 

posted by 뚱2
이번에 릴리즈된 iOS 5 Beta 7에서 테스트 어플을 하나 만들어보려고 오랜만에 XCode를 열었습니다.

그런데 우잉???


Windows-Based Application이 없어졌네요.
그래서 할 수 없이 Empty Application을 선택했습니다.


그리고 새로운 Use Automatic Reference Counting이라는 항목이 생겼군요. 레퍼런스 카운팅을 자동으로 해주는 것 같은데
우선 테스트 어플이 급하기에 체크 해제하고 생성합니다.


TestApp이라는 이름으로 어플을 생성했습니다.
Empty Application이라더니 기존에 있던 MainWindow.xib 파일이 보이지 않습니다.
그럴때는 할 수 없이 수동으로 연결을 해야 하는 군요.


새로운 UIViewController를 하나 만들었습니다.
xib파일을 포함해서 만들었는데요. 이제 코드로 연결을 해줘야 합니다.

Empty Application 으로 만들면 'AppDelegate.h, AppDelegate.m'파일이 생성됩니다.

// AppDelegate.h
//

@property (strong, nonatomic) UIWindow *window;
@property (nonatomic, retain) MainViewController *mainView;

@end
//]]>



//AppDelegate.m
#import "AppDelegate.h"
#import "MainViewController.h"

@implementation AppDelegate

@synthesize window = _window;
@synthesize mainView;

- (void)dealloc
{
    [mainView release];
    [_window release];
    [super dealloc];
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    // Override point for customization after application launch.
    self.window.backgroundColor = [UIColor whiteColor];
    
    mainView = [[MainViewController alloc] initWithNibName:@"MainViewController" bundle:nil];
    
    if ( mainView != nil ) 
    {
        [self.window addSubview:mainView.view];
    }
    
    [self.window makeKeyAndVisible];
    return YES;
}

// 이하 코드 ...




  이렇게 연결을 했더니 전과 같이 화면이 밀리는 경향이 있습니다.
그래서 MainViewController.m 파일을 수정했습니다.
// MainViewController.m  
#import "MainViewController.h"

@implementation MainViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
        [self.view setFrame:[[UIScreen mainScreen] applicationFrame]];
    }
    return self;
}

// 이하 코드 ...
 
posted by 뚱2

오늘 아이폰 기본 '사진'앱 값이 화면을 클릭하면 토글 방식으로 Status, NavigationBar, ToolBar가 사라지거나
보여지는 앱을 만들어 봤습니다.
화면을 클릭하면 이벤트를 받기위해 화면 크기 만한 UIButton을 만들고 Custom으로 설정하고  
화면에서는 보이지 않게 하기 위해서 Alpha값은 0.0으로 했습니다.

그랬더니 이상하게 이벤트가 발생하지 않았습니다.
이상해서 이리저리 해보다가 Alpha값을 0.0 초과로 지정 했더니 이벤트가 발생했습니다.
개발할때 실수 할수 있는 부분이라고 생각되어서 글 올려봅니다. 
posted by 뚱2



1. 제   목 : 아이폰 프로그래밍 UIKit 핵심 바이블

2. 출판사 : 정보문화사


3. 저   자 : 토코로 유타 / 김은철, 유세라 번역


4. 가   격 : 25,000원


5. 난이도 : 초중급 (★★★☆☆)


6. 판   매 : 판매중


7. 평   가 : ★★★★☆


아이폰 번역책이 나온지 한 2년쯤 되는 것 같습니다. 대부분의 아이폰 책은 기초서적이고


또한 아이폰 개발에 전반적인 사항을 다루고 있습니다.


그런 와중에 이책은 독보적인 책입니다.


다른 부분을 제외한 UI에 관련된 UIKit Framework만을 집중적으로 다루고 있습니다.


또한 인터페이스 빌더를 사용하지 않고 코드만으로 UIKit을 설명하고 있습니다.


이런 부분에 호불호가 있을수 있는데 저에게는 정말 베스트한 방식 입니다.


자동화 툴은 사용하기 편리하지만 배울때는 도움이 되지 않습니다.


자동화 이면에 가려진 원리가 보여지지 않게 때문에 나중에 응용력 부분에 문제가


생길수 있습니다. 결국 원리를 알아야지 응용력이라는게 생기는데


이 책은 그런 부분에 있어서 코드로만 UIKit을 설명하기에 기초 UIKit을 배우는데 정말


큰 도움이 됩니다. 


예전의 정보문화사 책을 참 많이 구입했었는데 어느순간부터 책을 선뜻 구입하지 않았던것 같습니다.


그 이유는 여러가지가 있는데 우선 내용이 예전만 못했고 책의 표지나 질이


다른 출판사에 비해서 떨어지는 느낌을 많이 받았습니다. 지금 이책도 책의 질이 두꺼운


은행 달력 용지(?)를 사용한 느낌이 드는데 책의 무게와 부피가 늘어나는 부분이라고 생각합니다.


책의 종이 질에 대한 부분은 개인적으로 인사이트의 책을 좋아라 합니다.


이야기가 이상한 방향으로 흘렀는데 근래들어 참 좋은 정보문화사 책입니다. 정보문화사 책 뿐만 아니

아이폰 책 중에서도 좋은 책입니다.

UIKit만을 설명하지만 인터페이스 빌더를 사용하지 않음으로 iOS의 돌아가는 방식을 다른 어떤 책


보다 많이 볼수 있는 책이라고 생각합니다.


특히 UI에 대한 레퍼런스 책으로 참 유용합니다.


posted by 뚱2
아이폰 앱을 보다보면은 아래 그림과 같이 반투명 뷰에 ActivityIndicator를 이용해서 화면에 뿌려주는 것을 볼수 있습니다.
궁금하기도 하고 나중에 써먹을 일이 있을것 같아서 인터넷으로 찾아봤는데 구글신이 외면했는지 못찾아서
짜집기로 직접 만들어 봤습니다.

 

//
//  UIActivityIndicatorRoundView.h
//  AlphaTest
//
//  Created by Dae Jun Ko on 11. 8. 13..
//  Copyright 2011년 __MyCompanyName__. All rights reserved.
//

#import 

#define kDefaultStrokeColor         [[UIColor blackColor] colorWithAlphaComponent:0.5]
#define kDefaultRectColor           [[UIColor blackColor] colorWithAlphaComponent:0.5]
#define kDefaultStrokeWidth         0.0
#define kDefaultCornerRadius        10.0

@interface UIActivityIndicatorRoundView : UIView

@property (nonatomic, retain) UIColor *strokeColor;
@property (nonatomic, retain) UIColor *rectColor;
@property (nonatomic, assign) CGFloat strokeWidth;
@property (nonatomic, assign) CGFloat cornerRadius;
@property (nonatomic, retain) UIActivityIndicatorView *activityIndicator;
@end


//
//  UIActivityIndicatorRoundView.m
//  AlphaTest
//
//  Created by Dae Jun Ko on 11. 8. 13..
//  Copyright 2011년 __MyCompanyName__. All rights reserved.
//

#import "UIActivityIndicatorRoundView.h"

@implementation UIActivityIndicatorRoundView

@synthesize strokeColor, rectColor;
@synthesize strokeWidth, cornerRadius;
@synthesize activityIndicator;

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        self.opaque = NO;
        self.strokeColor = kDefaultStrokeColor;
        self.rectColor = kDefaultRectColor;
        self.strokeWidth = kDefaultStrokeWidth;
        self.cornerRadius = kDefaultCornerRadius;
        
        self.activityIndicator 
        = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
        CGPoint mycenter;
        mycenter.x = frame.size.width/2;
        mycenter.y = frame.size.height/2;
        self.activityIndicator.center = mycenter;
        [self.activityIndicator startAnimating];
        [self addSubview:activityIndicator];
    }
    return self;
}


// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetLineWidth(context, strokeWidth);
    CGContextSetStrokeColorWithColor(context, self.strokeColor.CGColor);
    CGContextSetFillColorWithColor(context, self.rectColor.CGColor);
    
    CGRect rrect = self.bounds;
    
    CGFloat radius = cornerRadius;
    CGFloat width = CGRectGetWidth(rrect);
    CGFloat height = CGRectGetHeight(rrect);
    
    // Make sure corner radius isn't larger than half the shorter side
    if (radius > width/2.0)
        radius = width/2.0;
    if (radius > height/2.0)
        radius = height/2.0;    
    
    CGFloat minx = CGRectGetMinX(rrect);
    CGFloat midx = CGRectGetMidX(rrect);
    CGFloat maxx = CGRectGetMaxX(rrect);
    CGFloat miny = CGRectGetMinY(rrect);
    CGFloat midy = CGRectGetMidY(rrect);
    CGFloat maxy = CGRectGetMaxY(rrect);
    CGContextMoveToPoint(context, minx, midy);
    CGContextAddArcToPoint(context, minx, miny, midx, miny, radius);
    CGContextAddArcToPoint(context, maxx, miny, maxx, midy, radius);
    CGContextAddArcToPoint(context, maxx, maxy, midx, maxy, radius);
    CGContextAddArcToPoint(context, minx, maxy, minx, midy, radius);
    CGContextClosePath(context);
    CGContextDrawPath(context, kCGPathFillStroke);
    
    [self bringSubviewToFront:activityIndicator];
}


-(void)dealloc
{
    [activityIndicator release];
    
    [strokeColor release];
    [rectColor release];
    
    
    [super dealloc];
}

@end


// 사용법
#pragma mark-
#pragma mark clickAlert
-(IBAction)startAlert:(id)sender
{
    if ( viewAlert )
        return;
    
    CGRect frame = [self.view frame];
    CGRect newFrame;

    newFrame.size.width = frame.size.width/2;
    newFrame.size.height = frame.size.width/2;
    newFrame.origin.x = (frame.size.width - newFrame.size.width) / 2;
    newFrame.origin.y = (frame.size.height - newFrame.size.height) / 2;
    
    if ( ( viewAlert = [[UIActivityIndicatorRoundView alloc] initWithFrame:newFrame] ) )
    {   
         [self.view addSubview:viewAlert];
    }
}

-(IBAction)stopAlert:(id)sender
{
    if ( viewAlert == nil )
        return;
    
    [viewAlert removeFromSuperview];
    [viewAlert release];
    viewAlert = nil;
}
#pragma mark-


만드는 방법은 여러가지가 있겠으나 전 쿼츠를 이용해서 그렸습니다.
그리는 방법은 아이폰 예제 QuartzDemo와 http://iphonedevelopment.blogspot.com/2008/11/creating-transparent-uiviews-rounded.html를 참조했습니다.

posted by 뚱2
우리은행 아이폰 앱을 사용하면은 아래 탭바가 애니메이션 처리되는 것을 알 수 있다.

 

이걸 보고 나도 궁금해서 찾아보았다.

 기능 똑 같이 구현했는데 아무리 아이폰이라도 결국 이쁜 이미지가 없으면 말짱 꽝이라는걸 느꼈다.


우선 인터페이스 빌더에서 아래 UIView 오브젝트를 넣어준다.
'올리기', '내리기' 버튼은 당연 IBAction 잡아준다.

#import <UIKit.h>


@interface AnimationTestAppDelegate : NSObject<UIApplicationDelegate>

@property (nonatomic, retain) IBOutlet UIWindow *window;

@property (nonatomic, retain) IBOutlet UIView *viewTabbar;

@property (nonatomic, assign) CGRect viewFrame;

 

-(IBAction)clickedUp:(id)sender;

-(IBAction)clickedDown:(id)sender;

 

@end

//AnimationTestAppDelegate.m 

#import "AnimationTestAppDelegate.h"

@implementation AnimationTestAppDelegate

@synthesize window = _window;
@synthesize viewTabbar;
@synthesize viewFrame;

#pragma mark-
#pragma mark button events
-(IBAction)clickedUp:(id)sender
{
    // 애니메이션을 보여준다.
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.3];
    
    self.viewTabbar.frame = viewFrame;
    
    
    [UIView commitAnimations];    
}

-(IBAction)clickedDown:(id)sender
{
    // 애니메이션을 보여준다.
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.3];
    
    CGRect screen = [[UIScreen mainScreen] bounds];
    CGRect rect = self.viewTabbar.frame;
    rect.origin.y = screen.size.height;
    self.viewTabbar.frame = rect;
    
    
    [UIView commitAnimations];
}
#pragma mark-


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.
    self.viewFrame = viewTabbar.frame;
    
    [self.window makeKeyAndVisible];
    return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application
{
    /*
     Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
     Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
     */
}

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    /*
     Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 
     If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
     */
}

- (void)applicationWillEnterForeground:(UIApplication *)application
{
    /*
     Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
     */
}

- (void)applicationDidBecomeActive:(UIApplication *)application
{
    /*
     Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
     */
}

- (void)applicationWillTerminate:(UIApplication *)application
{
    /*
     Called when the application is about to terminate.
     Save data if appropriate.
     See also applicationDidEnterBackground:.
     */
}

- (void)dealloc
{
    [viewTabbar release];
    
    [_window release];
    [super dealloc];
}

@end

이벤트 부분과 앱 처음 구동될때 인터페이스빌더에서 잡아주었던 위치 저장 부분 'viewFrame'만 확인하면 된다.
이제 UIView로 구현된 부분에 다른 컨트롤들을 올리면 탭바 비스무리 하게 사용할 수 있다.



posted by 뚱2
* 애플 문서 "The Application Life Cycle"에서 참조

모든 이벤트를 받는 일은 UIApplication에서 담당하고 개발자는 이벤트에 대한 응답 코드를 작성하는 형식으로 개발한다.
사실 내가 아는 Window 프로그램도 이와 같은 방식으로 개발된다.
물론 Window 프로그램은 그 이벤트 루프마져도 개발자가 건드릴수 있게 한게 다르다면 다르겠다.
간단한 내용이지만 정말 중요한 내용이기에 올려본다. 
posted by 뚱2

-(IBAction)clickedAlert1:(id)sender
{
    NSLog(@"clickedAlert1:");
    
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"로그인" 
                                                    message:@"\n\n\n" 
                                                   delegate:self 
                                          cancelButtonTitle:nil 
                                          otherButtonTitles:@"취소", @"확인", nil];

    // 아이디
    UITextField *fieldID = [[UITextField alloc] initWithFrame:CGRectMake(17.0, 50.0, 250.0, 30.0)];
    fieldID.backgroundColor = [UIColor whiteColor];
    fieldID.borderStyle =  UITextBorderStyleNone;
    fieldID.font = [UIFont fontWithName:@"Helvetica" size:20];
    fieldID.placeholder = @"아이디";
    fieldID.tag = 1000;
    [fieldID becomeFirstResponder]; // 첫번째에 키보드 포커스를 가게 한다.

    [alert addSubview: fieldID];
    [fieldID release];
    
    // 비밀번호
    UITextField *fieldPwd = [[UITextField alloc] initWithFrame:CGRectMake(17.0, 81.0, 250.0, 30.0)];
    fieldPwd.backgroundColor = [UIColor whiteColor];
    fieldPwd.borderStyle =  UITextBorderStyleNone;
    fieldPwd.font = [UIFont fontWithName:@"Helvetica" size:20];
    fieldPwd.placeholder = @"비밀번호";
    fieldPwd.secureTextEntry = TRUE;
    fieldPwd.tag = 1001;
    
    [alert addSubview: fieldPwd];
    [fieldPwd release];    
    
    [alert show];
    [alert release];
}


위와 같이 특정 이벤트에서 설정해주고
UIAlertViewDelegate 에서 tag값으로 컨트롤들을 가져와서 값을 읽어오면 된다. 
또한 자신의 앱에 맞게 Custom AlertView를 만들고 싶으면
UIAlertView를 상속 받고 drawRect 오버라이딩 해서 직접 그려줘야 한다. 
posted by 뚱2
인터페이스 빌더에서 컨트롤러를 연결하면 위치가 잘 나온다.
 


 
그런데 프로그램 코드상에서 연결하면 아래와 같이 나온다.
 

딱 Status Bar 크기 CGRect로 20포인트 만큼 위로 올라갔다.
코드에서 해당 View 를

myRootViewController 
    = [[MyRootViewController alloc] initWithNibName:@"MyRootViewController" 
                                             bundle:nil];
[self.window addSubview:myRootViewController.view];
[myRootViewController.view setFrame:CGRectMake(0, 20, 320, 460)];


20 포인트만큼 내려주자.  

ps. XCode 3.2와 XCode 4.XX 버전에서 View-base Application을 만들면 내부 구조가 다릅니다. 이부분을 정확하게 확인해 봐야 겠습니다.
     지금 문제는 단순하게 밀린 화면을 위로 올린것 뿐 입니다. 

#해결 (2011-08-08)
20 포인트로 고정하면 기기에 따른 status바가 다를수 있습니다. 일예로 아이패드와 호환성 문제가 발생할수 있습니다.
이때 UIScreen 으로 장치의 해상도와 실제뷰 화면의 해상도를 가져오면 유리 합니다.
    CGRect rect = [[UIScreen mainScreen] applicationFrame];
    [myRootViewController.view setFrame:rect];

 실제 디버깅 값입니다.
참고 : http://maccrazy.tistory.com/74 


추가 : 2012.03.04
iOS 5.0 이상부터는 아래와 같이 코딩하면 됩니다.
 
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    self.viewController = [[HelloWorldViewController alloc] initWithNibName:@"HelloWorldViewController" 
                                                                     bundle:nil];

    self.window.rootViewController = self.viewController;

    
    // Override point for customization after application launch.
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
    return YES;
posted by 뚱2
아이폰 개발하면서 XCode 상에서 직접디버깅을 할 수도 있지만 gdb를 이용해서 디버깅을 할수도 있습니다.
익숙해지면 정말 편합니다.

단축키 모음
* 브레이크 포인트 
b func
b 10
b file.c:func
b file.c:10
b +2
b -2
b *0x8049000
b 10 if var == 0

* 브레이크 포인트 지우기
cl func
cl 10
cl file.c:func
cl filec:10
d

* 진행 명령어
s
s 5
n
n 5
c
u
finish
return
return 123
si
ni

* 출력명령
p [변수명]
p [함수명]
p/[출력형식][변수명] 
p '[파일명]'::[변수명] 
p [함수명]::[변수명]
p [변수명]@[배열 크기] 
po

* 디스플레이 관련 명령
display [변수명]
display/[출력 형식][변수명]
undisplay [디스플레이 번호]
disable display [디스플레이 번호]
enable display [디스플레이 번호]

이정도만 알아도 디버깅 하는데 충분하다. 
설명은 차후 추가

참조 : 유닉스, 리눅스 프로그래밍 필수 유틸리티(백창우)
 
posted by 뚱2
Couldn't register XXX with the bootstrap server. Error: unknown error code. This generally means that another instance of this process was already running or is hung in the debugger.Program received signal: “SIGABRT”.


아무 이상도 없는데 디버그로 실행하다 보면 발생한다.
소스코드를 눈씼고 찾아봤고 다 뒤져봤는데 결국 못찾았다.
구굴링한 결과 리부팅이 직빵이라고 한다.

ps. 리부팅 하지 않아도 Xcode를 Command+Q로 종료하고 다시 실행하면 정상적으로 작동한다.

 
posted by 뚱2

1. 제   목 : Beginning iOS4 Application Development (렛츠고! iOS 4 애플리케이션 개발)
2. 출판사 : 제이펍
3. 저   자 : 
웨이멍 리 저/황반석 역
4. 가   격 : 35,000원
5. 난이도 : 초중급 (
★★☆)
6. 판   매 : 판매중
7. 평   가 : 


거두절미 하고 이 책은 Beginning이라는 이름을 달고 있지만 이 책가지고 iOS 개발을 시작하기는 쉽지 않아 보입니다.
책의 마지막 부록 부분에 Obejctive-C에 대한 특강이 있기는 하지만 부족합니다.
제가 보기에 처음 시작은 Head First iPhone Development  같은 책으로 컨셉을 잡으시는게 좋아보입니다.
이 책의 장점은 Cookbook같이 한 챕터 하나 하나가 레퍼런스로 유용하다는데 있습니다.

개인적으로 'Chapter 06 키보드 입력'의 키보드 사라지게 만들기는 참 유용했습니다.
실제 개발들어갔을때 참조하고 싶은 내용만 바로 바로 참조 할 수 있게 한점이 저에게는 편하더군요.
그리고 각 장의 마지막에 이번장에서 배운 내용을 짧은 표 형식으로 요약한 것도 한눈에 정리가 잘되게 작성 되었습니다.

역자 후기중...
'그렇다! 역자의 입장이 아닌 개발자의 입장으로 볼 때 이 책은 정말로 대단하다. 이 책 한 권이라면 아이폰에서 사용되는 대부분의 기능들을 충분히 구현할 수 있다. 게다가 저자의 집필 방식이 참으로 맘에 들었다. 예를 들어, 대부분의 책들은 어떤 부분을 따라 하려면 이전 장의 (심지어는 몇몇 장에 걸친) 내용과 예제를 하지 않고서는 할 수 없는 구성들이 많다. 그러나 이 책은 독자가 알기 원하는 부분이 맨 앞에 있든 맨 뒤에 있든, 바로 그곳에서부터 시작해도 쉽게 이해할 수가 있게 구성되어 있다. 또한 이 책은 보통의 입문서에는 잘 포함되지 않는 고급 주제들을 많이 다루고 있으며, 상세하게 하나하나씩 설명하고 있다.'


위의 역자 말이 정말 딱 들어맞는 책입니다. 또한 번역책이지만 읽는데 지장없이 잘 번역되었습니다.
다만 책 앞부분에서 alloc후 release를 안한 소스가 보이더군요. 소스에 대한 정확한 검증이 조금 더 필요할것 같습니다.
이 책은 공부보다는 실제 개발시 더 도움이 될만한 책 같습니다. 물론 공부시에도 도움됩니다.
posted by 뚱2