2012. 7. 18. 16:48 아이폰

android에서  쓰레드 중에 이미지를 갱신해야되는 경우나 ...네트워크를 접속 해야하는 경우에 handler를 호출해서 작업을 진행 하곤 했다 



아이폰에서 

아래의 함수 goMenu안에서 호출 되고 있는 곳에서 메인 쓰레드로 작업을 진행 하고 싶은 경우 

 [NSThread detachNewThreadSelector:@selector(goMenu:) toTarget:self withObject:btn];


요거 써주니깐 되더라 change 부분에서는 네트워크 접속 하는 부분이 들어있다 

-(void)goMenu:(id)sender

{

 [self performSelectorOnMainThread:@selector(change:) withObject:[NSNumber numberWithInt:14] waitUntilDone:NO];

}

-(void)change:(id)sender

{

작업해라 
}

        

posted by 욱이다
2012. 7. 11. 15:51 아이폰

원문

http://drzekil.tistory.com/369


스크린샷은 


커맨드 + 쉬프트 + 4 는 원하는 부분만 

커맨드 + 쉬프트 + 3 은 전체 


저장되는 곳은 바탕 화면 



원문에 보면 여러 기능이있지만 .. 

이것만 알아도 충분 할 듯 


posted by 욱이다
2012. 7. 11. 15:47 아이폰

아이폰 언어 지역화


프로젝트 TARGETS 에서 INFO에서 


Localization native development region 에서 +눌러 Localizations를 눌러 한국어 추가 할려면  ko로 값 넣고 






Supporting files 에서 새파일을 생성하는데  ios-> resource -> String File 생성 이름은 Localizable.strings가 된다 




프로젝트 네비게이션에서 생성된 Localizable.strings를 선택 해놓고 sdk의 최 우측의 창 을 띄워서 ...







언어 설정 추가 Localization에서 +버튼 눌러서 원하는 언어를 추가하면 


이렇게 영어 한글의 스트링 파일이 뜬다 

그럼 각각의 파일에 맞게 

한글에는 "Test"="kor";

영어에는 "Test"="en";

이렇게 넣어두고 


원하는 곳에서는 NSLocalizedString(@"Test",nil) 이렇게 해서 쓰면된다

nil에는 사용자가 코멘트를 넣을 수있다 





posted by 욱이다
2012. 7. 10. 13:43 아이폰

좀비 모드 설정


http://dkdlfjqmalst.blog.me/10134345416



xcode 4


alt - command - r 

버튼누르고 

enable zombie objecs 체크

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

맥 컴퓨터 스크린 샷 하기 mac screen shot  (0) 2012.07.11
아이폰 언어 지역화 방법  (0) 2012.07.11
아이폰 스레드 쓰는 방법  (0) 2011.10.19
Objective c 정리  (0) 2011.07.01
UITableView 기본 세팅 값들  (0) 2011.07.01
posted by 욱이다
2011. 10. 19. 10:40 아이폰



문씨 강좌 참고 햇음
http://cafe.naver.com/mcbugi


스레드 돌릴때 스레드 안에서 UI처리할때 에러 나는 상황의 처리 방법


//스레드 돌아라고할때 명령어

NSThread *_thread = [[NSThread alloc]initWithTarget:self selector:@selector(_th) object:nil];
[_thread start];//스레드 시작
/////////////////////////////////

-(void)_th{
//NSString 생성에 오토릴리즈가 포함 되어있기 때문에
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init];
int count = 0 ;
while([[NSThread currentThread]isCancelled]==NO)
{
count ++;
NSString *t = [NSString stringWithFormat:@"%i",count];
//메인스레드에서 그리는 부분은 새로 생성된 스레드에서 처리 할 수없다
[self performSelectorOnMainThread"@selector(mainThreadSetText:) withObject:t waitUntilDone:YES];
[NSThread sleepForTimeInterval:1.0];
}
[pool release];
}
-(void)mainThreadSetText:(NSString *)text{
_Label.text = text;
}

[_thread cancel];///스레드 멈춤

posted by 욱이다
2011. 7. 1. 14:01 아이폰

 정리 다 필요없고 

http://www.cocoadev.co.kr/33

이블로그 찾아 보면 끝난다 
objective c 설명이 잘되어있다

 


#define _TESTDEF

#ifdef _TESTDEF

#define TESTDEFLOGIC(a) (a+10)

#else

#define TESTDEFLOGIC(a) (a+15)

#endif



int testintarray[]={0,1,2,3,4,5};

int a[10] = { 0, 2, 4, 6, 8 }; //0~4까지 입력되고 나며지는 0으로 세팅된다 

int *testpointarray;


typedef struct _st{

int a;

}st;

struct employee {

int id;

};

enum testenum {

ENUM_0,

ENUM_1

};   


id *struc;

struc = malloc(sizeof(st));

((st *)struc)->a = 100;

NSLog(@"%d",((st *)struc)->a);

free(struc);

st *struc2;

struc2 = malloc(sizeof(st));

struc2->a = 100;

NSLog(@"%d",struc2->a);

free(struc2);

testpointarray = malloc(sizeof(int) * 10);

testpointarray[0]=1;

NSLog(@"%d",testpointarray[0]);

free(testpointarray);

struct employee emp1[2];

emp1[0].id = 99;

NSLog(@"%d",emp1[0].id);

NSLog(@"%d",ENUM_0);

NSLog(@"%d",ENUM_1);

NSLog(@"TESTDEFLOGIC %d",TESTDEFLOGIC(10)); 

posted by 욱이다
2011. 7. 1. 00:35 아이폰

기본적으로다가 테이블 뷰 세팅 값들 

//

//  testtabbarmain.h

//  testtabbartest

//

//  Created by sons on 11. 6. 30..

//  Copyright 2011 __MyCompanyName__. All rights reserved.

//


#import <UIKit/UIKit.h>



@interface testtabbarmain : UITableViewController {


NSArray *data;

NSArray *datasection;

}


@property(nonatomic,retain) NSArray *data;

@property(nonatomic,retain)IBOutlet NSArray *datasection;

@end




//

//  testtabbarmain.m

//  testtabbartest

//

//  Created by sons on 11. 6. 30..

//  Copyright 2011 __MyCompanyName__. All rights reserved.

//


#import "testtabbarmain.h"



@implementation testtabbarmain


@synthesize data;//,datasection;


static NSString *kData=@"kData";


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.

- (void)viewDidLoad {

    [super viewDidLoad];

data = [[NSArray alloc ]initWithObjects:

[NSDictionary dictionaryWithObjectsAndKeys:@"Data1",kData,nil],

[NSDictionary dictionaryWithObjectsAndKeys:@"Data2",kData,nil],

[NSDictionary dictionaryWithObjectsAndKeys:@"Data3",kData,nil],nil];

}


- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView

{//섹션의 갯수 (로우를 그룹으로 가지고있다)

return 2;//[self.dataSourceArray count];

}


- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section

{

//섹션의 타이틀 (로우를 그룹으로 가지고있는 섹션의 타이틀 (보통회색바로 나타난다 ))

NSLog(@"titleForHeaderInSection %d %p",section,data);

return [[data objectAtIndex: section] valueForKey:kData];

}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

{

//섹션안의 로우 갯수 

return [data count];

}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

{

static NSString *CellId = @"cell";

NSLog(@"cellForRowAtIndexPath %d",indexPath.row);


UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellId];

if (cell == nil)

{

// a new cell needs to be created

cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault

  reuseIdentifier:CellId] autorelease];

}

cell.textLabel.text = [[data objectAtIndex: indexPath.row] valueForKey:kData];

//cell.detailTextLabel.text =[[data objectAtIndex: indexPath.row] valueForKey:kData];;

    return cell;

}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath

{

//로우의 높이 나타낸다 

return ([indexPath row] == 0) ? 50.0 : 22.0;

}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

{

/*로우를 눌렀을때 일어나는 액션*/

}

- (void)didReceiveMemoryWarning {

    // Releases the view if it doesn't have a superview.

    [super didReceiveMemoryWarning];

    

}


- (void)viewDidUnload {

    [super viewDidUnload];

   

}



- (void)dealloc {

[datasection release];

[data release];

data = nil;

    [super dealloc];

}



@end


posted by 욱이다
2011. 6. 30. 22:03 아이폰

UIViewController붙이기 
 

델리게이트.m파일

#import
"testTableViewCellAppDelegate.h"


@implementation testTableViewCellAppDelegate


@synthesize window,viewController;



#pragma mark -

#pragma mark Application lifecycle


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

    

    // Override point for customization after application launch.

    [self.window addSubview:viewController.view];

    [self.window makeKeyAndVisible];

    

    return YES;

}


델리게이트.h 파일

#import <UIKit/UIKit.h>


@interface testTableViewCellAppDelegate : NSObject <UIApplicationDelegate> {

    UIWindow *window;

    UIViewController *viewController;

}

@property (nonatomic, retain)IBOutlet UIViewController *viewController;

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


@end




여기서 부터 xib파일 설정 
mainwindow.xib파일에서
라이브러리에서 viewController를 드래그해서 리스트에 옮긴다 

delegate를누르면 inspector 에 위에서 선언한 viewController가 보인다 그걸 잡아서 
mainwindow.xib 파일에 추가한 viewController에 연결시킨다  
안된다면 mainwindow.xib 파일에 추가한 viewController를 선택해서 라이브러리의 클레스 이름을 선언한다
(나는 xib가 생성되는 파일을 생성했다 이름을 testTableViewContorller라고 선언했다 ) 

그리고 실행하면 testTableViewController의 xib파일이 에뮬에서 보인다 

UINavigationController붙이기 
 

UINavigationController붙이는것은 UINavigationController붙이는 것과 거의 같다 소스 부분은
고친게 UIViewController를 UINavigationController로 바꾼것 뿐이다 
 
델리게이트.m파일


#import 
"testTableViewCellAppDelegate.h"


@implementation testTableViewCellAppDelegate


@synthesize window,viewController;



#pragma mark -

#pragma mark Application lifecycle


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

    

    // Override point for customization after application launch.

    [self.window addSubview:viewController.view];

    [self.window makeKeyAndVisible];

    

    return YES;

}


델리게이트.h 파일

#import <UIKit/UIKit.h>


@interface testTableViewCellAppDelegate : NSObject <UIApplicationDelegate> {

    UIWindow *window;

    UINavigationController *viewController;

}

@property (nonatomicretain)IBOutlet UINavigationController *viewController;

@property (nonatomicretainIBOutlet UIWindow *window;


@end



xib 설정이 조금 다르다
여기서 부터 xib파일 설정 

mainwindow.xib파일에서 
라이브러리에서 navigationController를 드래그해서 리스트에 옮긴다 

delegate를누르면 inspector 에 위에서 선언한 viewController가 보인다 그걸 잡아서 
mainwindow.xib 파일에 추가한 navigationController를 연결시킨다  
안된다면 mainwindow.xib 파일에 추가한 navigationController를 선택해서 하단의 UIView..라고 적힌 것을 클릭한다
그리고  라이브러리의 클레스 이름을 선언한다

(나는 xib가 생성되는 파일을 생성했다 이름을 testTableViewContorller라고 선언했다 ) 

그리고 실행하면 testTableViewController의 xib파일이 에뮬에서 보인다 
 
 

posted by 욱이다
2011. 6. 29. 17:52 아이폰
아이폰 관련 ui 들의 사용방법을 자세히 나열해 놓고있다 

뭐가 있나요?

죄다 있다
alertview, button, pickerview, searchbar, textfield, textview, toolbar, webview, segmentview, ImageView, controlview,tableview

위의 내용이 다있으니 이것만 독파하면 나도 이제 아이폰 ui는  볼줄 아는구나 ~ 할꺼다 

그럼 그 프로젝트가 어디있나 ??

xcode 띄워서 소스코드에 UIButton 같은거 넣고 option키 눌러 더블클릭하면 뭐가 뜨는데 

거기 우측 상단에 책모양 클릭하면 Reference가 뜨면

Related sample code 요기에보면 

UICatalog가 있다  


헬프에 서도 이동가능하지만 다때려치고 아래에 파일 첨부했다 


UICatalog.zip

 


 


posted by 욱이다
2011. 4. 18. 23:47 아이폰

 build and archive 하는 중 아이콘 에러 


iPad: Icon.png: icon dimensions (57x57) don't meet the size

requirements. The icon file must be 72x72 pixels, in .png format




해답) 프로젝트의 get info-> build -> target device family를 알맞게 설정 나는 iphone만 서비스할꺼니깐 iphone으로 설장했습니다 

posted by 욱이다
prev 1 2 3 4 next