CGRect frame = _textView.frame; frame.size.height = _textView.contentSize.height; _textView.frame = frame; Edit: sizeThatFits returns the size but does not actually resize the component. I'm not sure if that's what you want, or if [textView sizeToFit] is more what you were looking for. In either case, I do not know if it will perfectly fit the content like you want, but it's the first thing to t..
#if __IPHONE_3_2 && __IPHONE_3_2
-- 데이터 복구 관련 --Check .bak FileInfo RESTORE HEADERONLY FROM DISK = 'D:\backup\2010 12 23\iwantor.bak' RESTORE FILELISTONLY FROM DISK = 'D:\backup\2010 12 23\iwantor.bak' --위 명령어로 체크 후 아래 내용 참고 --Restore the Database RESTORE DATABASE IWantor FROM DISK = 'D:\backup\2010 12 23\iwantor.bak' WITH Move 'MentoLog_Data' TO 'D:\data\iwantor.mdf', Move 'MentoLog_Log' TO 'D:\data\iwantor.ldf' 데이터 이전 시 데이터 베..
위 태그 삽입 이것도 삽입..
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"URL"] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:15.0]; NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
0x80000000 + kCFStringEncodingDOSKorean NSURLConnection 을 사용해 return 받을때 서버가 UTF-8 임에도 EUC-KR로 줄때 -_-. NSData *returnData = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil]; NSString *str = [[NSString alloc] initWithData:returnData encoding:0x80000000 + kCFStringEncodingDOSKorean];
NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:@"22", @"published",@"33",@"key",nil]; NSDictionary *dic2 = [NSDictionary dictionaryWithObjectsAndKeys:@"23", @"published",@"34",@"key",nil]; NSDictionary *dic3 = [NSDictionary dictionaryWithObjectsAndKeys:@"22", @"published",@"35",@"key",nil]; NSDictionary *dic4 = [NSDictionary dictionaryWithObjectsAndKeys:@"24", @"published",@"36",..
#pragma mark - #pragma mark UIWebViewDelegate -(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { //YES 면 링크 가능(처음에 불러올때도 인식하니 주의) NO면 다른페이지 안됨 ㅋㅋ return !whenLoaded; } - (void)webViewDidStartLoad:(UIWebView *)webView { // starting the load, show the activity indicator in the status bar [UIApplication sha..
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; - Notification 받기 [nc addObserver:self selector:@selector(myMethod:) name:@"myNotiName" object:nil]; - Notification 날리기 [nc postNotificationName:@"myNotiName" object:self userInfo:nil]; - Notification 해제 [nc removeObserver:self name:@"myNotiName" object:nil]; 메소드 선언은 다음과 같이 -(void)myMethod:(NSNotification *)noti{ NSString *stringVa..
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; NSDate *date = [NSDate date]; NSDateComponents *hourDate = [gregorian components:kCFCalendarUnitHour fromDate:date]; NSDateComponents *minuteDate = [gregorian components:kCFCalendarUnitMinute fromDate:date]; NSDateComponents *secondDate = [gregorian components:kCFCalendarUnitSecond fromDate:date]; int ho..
//장면 전환 효과들 중에 옆으로 밀려서 나오고 스르륵 하고 그런효과들.. 책장 넘기는것 같은 효과 같은건 UIAnimationTransition #import CATransition *transition; // First create a CATransition object to describe the transition transition = [CATransition animation]; // Animate over 3/4 of a second transition.duration = 0.75; // using the ease in/out timing function transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaT..
//웹에서 이미지 불러와서 표시 //http://imgmovie.naver.com/mdi/mi/0490/49008_P51_144449.jpg UIImage *img = [[UIImage imageWithData: [NSData dataWithContentsOfURL: [NSURL URLWithString: @"http://imgmovie.naver.com/mdi/mi/0490/49008_P51_144449.jpg"]]] retain]; if (img != nil) { // Image was loaded successfully. [myImageView setImage:img]; [myImageView setUserInteractionEnabled:NO]; [img release]; // Release th..
//그냥 바로 html 문자열 보여주기 NSString *htmlString; htmlString = [NSString stringWithFormat:@"%@", @"Test String"]; myWebView.opaque = NO; myWebView.backgroundColor = [UIColor clearColor]; [self.myWebView loadHTMLString:htmlString baseURL:nil]; //웹상 URL을 읽어오려면 [self.myWebView loadRequest: [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.iphonedevsdk.com/forum/iphone-sdk-development/5573-ca..
-- XCode 4.2 부터 ARC 가 추가되어 좋은건 써야 겠기에 http://iphone.galloway.me.uk/iphone-sdktutorials/singleton-classes/ 참고 .m 에서는 아래 코드와 같이(TWEngine 을 자기 클래스 이름으로 ㅇ_ㅇ.) .h 에서는 NSCopying 프로토콜 추가 해야 될듯(선언은 +(TWEngine*)sharedTWEngine 만) static TWEngine *sharedTWEngineManager = nil; +(TWEngine*)sharedTWEngine { @synchronized(self) { if (sharedTWEngineManager == nil) sharedTWEngineManager = [[self alloc] init]; } ..
View Hierarchy - Manipulation • Add/remove views in IB or using UIView methods - (void)addSubview:(UIView *)view; - (void)removeFromSuperview; • Manipulate the view hierarchy manually: - (void)insertSubview:(UIView *)view atIndex:(int)index; - (void)insertSubview:(UIView *)view belowSubview:(UIView *)view; - (void)insertSubview:(UIView *)view aboveSubview:(UIView *)view; - (void)exchangeSubviewA..
UIApplicationDelegate • Xcode project templates have one set up by default • Object you provide that participates in application lifecycle • Can implement various methods which UIApplication will call • Examples: - (void)applicationDidFinishLaunching:(UIApplication *)application; - (void)applicationWillTerminate:(UIApplication *)application; 홈 버튼 눌렀을때(어플 종료전에 후다닥 처리해야 될 사항들) - (void)applicationW..
어떻게 알아 듣지도 못하는 영어로 강의하는 Stanford 자료(Itune U에 무료로 올라가 있음)가 공부하는데 도움이 더 되는듯 ㅠ_ㅠ + alloc ■ Class method that knows how much memory is needed (alloc 은 메모리 할당 과정) - init ■ Instance method to set initial values, perform other setup Obj-C에선 dealloc 을 직접 호출 하는 일이 없음(한가지 예외가 존재하긴 함.. 아래 코드) - (void)dealloc { // Do any cleanup that’s necessary // ... // when we’re done, call super to clean us up [super de..
----------------------------------------------------------------------------------------------------------------------------------------------------------------- error : No such file or directory iPhone 프로그래밍 할때 .m 과 .h 파일을 중복해서 만들기 귀찮을때 NSObject 의 subclass 로 Cocoa Class 로 생성 시킬때 접하게 되는 문제 #import 해당 문장을 아래와 같이.. #import ---------------------------------------------------------------------------..
델리게이트 띄우기 UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"My Title" message:@"Message" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil]; [alert show]; [alert release]; 델리게이트 메소드 -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { //구현 }
프로토콜 적용 //액션시트 할당 UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"My Title" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"OK" otherButtonTitles:@"Other1",@"Other2",nil]; //액션시트 띄우기 [actionSheet showInView:self.view]; //탭바 같은걸로 액션 시트 버튼이 안먹힐때 //[actionSheet showInView:[UIApplication sharedApplication].keyWindow]; //액션시트 해제 [actionSheet release]; -(void)act..
- (void)connectToServer { NSString *smsURL = @"http://www.google.co.kr"; NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease]; NSString *post = [NSString stringWithFormat:@"password=%@&id=%@",@"password",@"id"]; NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]; NSString *postLength = [NSString stringWithFormat:@"%d",[postData l..