2013 이전/iOS개발
[iOS 개발] UIButton title, image 위치 정리hagulu 하구루2017. 2. 25. 16:32
UIButton을 사용하다 보면 title, image등을 버튼위에 올려서 사용하게 된다.
[btn setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft]; [btn setContentVerticalAlignment:UIControlContentVerticalAlignmentBottom];
[btn setContentEdgeInsets:UIEdgeInsetsMake(0, 10, 0, 0)]; [btn setImageEdgeInsets:UIEdgeInsetsMake(0, 10, 0, 0)]; [btn setTitleEdgeInsets:UIEdgeInsetsMake(0, 10, 0, 0)];
'2013 이전 > iOS개발' 카테고리의 다른 글
[iOS 개발] UIButton title, image 위치 정리 (0) | 2017.02.25 |
---|---|
[iPad 개발] PopoverController contentSize 문제 (0) | 2017.02.25 |
[iOS 개발] 안정적이고 flexible 한 UITableViewCell UI 구현하기 (0) | 2017.02.25 |
[iOS 개발] UIPopoverController 의 EKEventEditViewController 키보드 문제 (0) | 2017.02.25 |
[iOS 개발] 현재 view의 모든 text editing 중단하기 (0) | 2017.02.25 |
[iOS 개발] 유용한 각종 UI controller open source 정리 사이트 (0) | 2017.02.25 |
댓글
2013 이전/iOS개발
[iPad 개발] PopoverController contentSize 문제hagulu 하구루2017. 2. 25. 16:32
PopoverController 를 사용하다보면 사이즈 때문에 골머리를 썩을 경우가 많을 것이다.
- (CGSize)contentSizeForViewInPopover { return CGSizeMake(320, 480); }
- (void) forcePopoverSize { CGSize currentSetSizeForPopover = self.contentSizeForViewInPopover; CGSize fakeMomentarySize = CGSizeMake(currentSetSizeForPopover.width - 1.0f, currentSetSizeForPopover.height - 1.0f); self.contentSizeForViewInPopover = fakeMomentarySize; } - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [self forcePopoverSize]; } - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; CGSize currentSetSizeForPopover = self.contentSizeForViewInPopover; self.contentSizeForViewInPopover = currentSetSizeForPopover; }
'2013 이전 > iOS개발' 카테고리의 다른 글
[iOS 개발] UIButton title, image 위치 정리 (0) | 2017.02.25 |
---|---|
[iPad 개발] PopoverController contentSize 문제 (0) | 2017.02.25 |
[iOS 개발] 안정적이고 flexible 한 UITableViewCell UI 구현하기 (0) | 2017.02.25 |
[iOS 개발] UIPopoverController 의 EKEventEditViewController 키보드 문제 (0) | 2017.02.25 |
[iOS 개발] 현재 view의 모든 text editing 중단하기 (0) | 2017.02.25 |
[iOS 개발] 유용한 각종 UI controller open source 정리 사이트 (0) | 2017.02.25 |
댓글
2013 이전/iOS개발
[iOS 개발] 안정적이고 flexible 한 UITableViewCell UI 구현하기hagulu 하구루2017. 2. 25. 16:31
UITableView 를 이용할때 Cell을 Customize 하여 사용하는 경우가 많을 것이다.
'2013 이전 > iOS개발' 카테고리의 다른 글
[iOS 개발] UIButton title, image 위치 정리 (0) | 2017.02.25 |
---|---|
[iPad 개발] PopoverController contentSize 문제 (0) | 2017.02.25 |
[iOS 개발] 안정적이고 flexible 한 UITableViewCell UI 구현하기 (0) | 2017.02.25 |
[iOS 개발] UIPopoverController 의 EKEventEditViewController 키보드 문제 (0) | 2017.02.25 |
[iOS 개발] 현재 view의 모든 text editing 중단하기 (0) | 2017.02.25 |
[iOS 개발] 유용한 각종 UI controller open source 정리 사이트 (0) | 2017.02.25 |
댓글
2013 이전/iOS개발
[iOS 개발] UIPopoverController 의 EKEventEditViewController 키보드 문제hagulu 하구루2017. 2. 25. 16:31
iOS5에서 PopoverController위에 EKEventEditViewController를 올려서 사용하다 보면 cancel 버튼이나 done 버튼을 통해서 나왔을때는 문제가 없지만,
- (BOOL)popoverControllerShouldDismissPopover:(UIPopoverController *)popoverController { EKEventEditViewController *ev = (EKEventEditViewController *)self.popoverController.contentViewController; for (UIView* view in [[ev navigationBar] subviews]) { if ([NSStringFromClass([view class]) isEqualToString: @"UINavigationButton"]) { UIButton* btn = (UIButton*)view; for (UIBarButtonItem* buttonItem in [btn allTargets]) { id target = [buttonItem target]; SEL sel = @selector(cancel:); if ([target respondsToSelector: sel]) { [target performSelector:sel]; NSLog(@"target = %@", NSStringFromClass([target class])); NSLog(@"action = %@", NSStringFromSelector(sel)); } } } } return YES; }
'2013 이전 > iOS개발' 카테고리의 다른 글
[iPad 개발] PopoverController contentSize 문제 (0) | 2017.02.25 |
---|---|
[iOS 개발] 안정적이고 flexible 한 UITableViewCell UI 구현하기 (0) | 2017.02.25 |
[iOS 개발] UIPopoverController 의 EKEventEditViewController 키보드 문제 (0) | 2017.02.25 |
[iOS 개발] 현재 view의 모든 text editing 중단하기 (0) | 2017.02.25 |
[iOS 개발] 유용한 각종 UI controller open source 정리 사이트 (0) | 2017.02.25 |
[iOS 개발] 지역에 맞게 날짜 표기 하기 (0) | 2017.02.25 |
댓글
2013 이전/iOS개발
[iOS 개발] 현재 view의 모든 text editing 중단하기hagulu 하구루2017. 2. 25. 16:30
textfeild 나 textView 등 text를 editing 하는 view를 만들다 보면
특히, resignFirstResponder를 통해서 해당 editing을 그만 두려고 해야할때,
cell위에 사용하거나 여러 view가 중첩되어 해당 view의 객체를 컨트롤 하기 힘든경우가 발생할 수 있다.
이때 해당하는 뷰의 모든 subview들의 editing을 그만 두도록 한번에 처리 할수 있는 메소드가 있다.
[targetView endEditing:YES];
'2013 이전 > iOS개발' 카테고리의 다른 글
[iOS 개발] 안정적이고 flexible 한 UITableViewCell UI 구현하기 (0) | 2017.02.25 |
---|---|
[iOS 개발] UIPopoverController 의 EKEventEditViewController 키보드 문제 (0) | 2017.02.25 |
[iOS 개발] 현재 view의 모든 text editing 중단하기 (0) | 2017.02.25 |
[iOS 개발] 유용한 각종 UI controller open source 정리 사이트 (0) | 2017.02.25 |
[iOS 개발] 지역에 맞게 날짜 표기 하기 (0) | 2017.02.25 |
[iOS 개발] iCloud keyValue Data Storage 사용 (0) | 2017.02.25 |
댓글
2013 이전/iOS개발
[iOS 개발] 유용한 각종 UI controller open source 정리 사이트hagulu 하구루2017. 2. 25. 16:26
iOS에서 쓰이는 기본적인 UI 컨트롤러 외에 좀더 편리한 Custom controller 를 구현하고자 한다면 다음 사이트를 먼저 찾아보고 해보기 바란다.
'2013 이전 > iOS개발' 카테고리의 다른 글
[iOS 개발] UIPopoverController 의 EKEventEditViewController 키보드 문제 (0) | 2017.02.25 |
---|---|
[iOS 개발] 현재 view의 모든 text editing 중단하기 (0) | 2017.02.25 |
[iOS 개발] 유용한 각종 UI controller open source 정리 사이트 (0) | 2017.02.25 |
[iOS 개발] 지역에 맞게 날짜 표기 하기 (0) | 2017.02.25 |
[iOS 개발] iCloud keyValue Data Storage 사용 (0) | 2017.02.25 |
[iOS 개발] 간단한 animation 처리 (0) | 2017.02.25 |
댓글
2013 이전/iOS개발
[iOS 개발] 지역에 맞게 날짜 표기 하기hagulu 하구루2017. 2. 25. 16:26
글로벌하게 앱을 배포하려 하다 보면 날짜 형식을 표시하는데 문제가 생긴다.
NSString *dateFormatString = @"yyyy MMMM d EEEE"; dateFormatString = [NSDateFormatter dateFormatFromTemplate:dateFormatString options:0 locale:[NSLocale currentLocale]]; NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init]; [dateFormat setDateFormat:dateFormatString]; NSLog(@"%@", [dateFormat stringFromDate:[NSDate date]]);
.
'2013 이전 > iOS개발' 카테고리의 다른 글
[iOS 개발] 현재 view의 모든 text editing 중단하기 (0) | 2017.02.25 |
---|---|
[iOS 개발] 유용한 각종 UI controller open source 정리 사이트 (0) | 2017.02.25 |
[iOS 개발] 지역에 맞게 날짜 표기 하기 (0) | 2017.02.25 |
[iOS 개발] iCloud keyValue Data Storage 사용 (0) | 2017.02.25 |
[iOS 개발] 간단한 animation 처리 (0) | 2017.02.25 |
[iOS 개발] UITableView 기본 delegate, datasource (0) | 2017.02.25 |
댓글
2013 이전/iOS개발
[iOS 개발] iCloud keyValue Data Storage 사용hagulu 하구루2017. 2. 25. 16:20
유니버셜 앱을 개발하여 배포할때 각 앱의 설정을 연동할때 유용하게 사용할 수 있는
NSUbiquitousKeyValueStore 라는 클래스를 통해서 쉽게 사용 할수 있다.
NSUbiquitousKeyValueStore* store = [NSUbiquitousKeyValueStore defaultStore]; [store setBool:YES forKey:@"kUsrDefAskDeleting"]; [store synchronize];보는 것처럼 간단하게 defaultStore 메소드를 통해서 keyValue를 셋할수 있는 객체를 얻어 올수 있고,
- (void)setString:(NSString *)aString forKey:(NSString *)aKey; - (void)setData:(NSData *)aData forKey:(NSString *)aKey; - (void)setArray:(NSArray *)anArray forKey:(NSString *)aKey; - (void)setDictionary:(NSDictionary *)aDictionary forKey:(NSString *)aKey; - (void)setLongLong:(long long)value forKey:(NSString *)aKey; - (void)setDouble:(double)value forKey:(NSString *)aKey; - (void)setBool:(BOOL)value forKey:(NSString *)aKey;위 메소드를 통해서 여러 형태의 객체를 저장할 수 있다.
NSUbiquitousKeyValueStore *keyStore = [NSUbiquitousKeyValueStore defaultStore]; [[NSNotificationCenter defaultCenter] addObserver:self selector: @selector(ubiquitousKeyValueStoreDidChange:) name: NSUbiquitousKeyValueStoreDidChangeExternallyNotification object:keyStore]; [keyStore synchronize];
위 와 같은 방법으로 notification을 등록해 준후에 해당 메소드를 구현해주기만 하면 된다.
-(void) ubiquitousKeyValueStoreDidChange: (NSNotification *)notification { // Get the list of keys that changed. NSDictionary* userInfo = [notification userInfo]; NSNumber* reasonForChange = [userInfo objectForKey:NSUbiquitousKeyValueStoreChangeReasonKey]; NSInteger reason = -1; // If a reason could not be determined, do not update anything. if (!reasonForChange) return; // Update only for changes from the server. reason = [reasonForChange integerValue]; if ((reason == NSUbiquitousKeyValueStoreServerChange) || (reason == NSUbiquitousKeyValueStoreInitialSyncChange)) { // If something is changing externally, get the changes // and update the corresponding keys locally. NSArray* changedKeys = [userInfo objectForKey:NSUbiquitousKeyValueStoreChangedKeysKey]; NSUbiquitousKeyValueStore* store = [NSUbiquitousKeyValueStore defaultStore]; NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults]; // This loop assumes you are using the same key names in both // the user defaults database and the iCloud key-value store for (NSString* key in changedKeys) { id value = [store objectForKey:key]; [userDefaults setObject:value forKey:key]; } } }
위 처럼 구현을 하였는데, 이는 apple developer page에서 그대로 가져다 쓴것이다.
'2013 이전 > iOS개발' 카테고리의 다른 글
[iOS 개발] 유용한 각종 UI controller open source 정리 사이트 (0) | 2017.02.25 |
---|---|
[iOS 개발] 지역에 맞게 날짜 표기 하기 (0) | 2017.02.25 |
[iOS 개발] iCloud keyValue Data Storage 사용 (0) | 2017.02.25 |
[iOS 개발] 간단한 animation 처리 (0) | 2017.02.25 |
[iOS 개발] UITableView 기본 delegate, datasource (0) | 2017.02.25 |
[iOS 개발] iCloud app 연동 설정 (0) | 2017.02.25 |
댓글
2013 이전/iOS개발
[iOS 개발] 간단한 animation 처리hagulu 하구루2017. 2. 25. 16:20
iOS를 통한 개발에 animation은 꽤나 중요한 부분이다.
CGRect rect = targetView.frame; rect.origin.x = 300; targetView.frame = rect; [UIView beginAnimations:nil context:nil]; [UIView setAnimationDelegate:self]; [UIView setAnimationDuration:0.3]; [UIView setAnimationRepeatCount:1]; rect = targetView.frame; rect.origin.x = 0; targetView.frame = rect; [UIView commitAnimations];
위 의 예제대로 수행을 하면 해당하는 targerView는 x좌표 300의 위치에서 x좌표 0의 위치로 자연스럽게 animation이 변화 하게 된다.
[UIView beginAnimations:nil context:nil];
해당 부분은에서 주목해야할 부분은 첫번째 파라 미터이다.
[UIView setAnimationDuration:0.3]; [UIView setAnimationRepeatCount:1];
위의 첫번째 메소드는 animation이 진행되는 시작이다 이를 길게 하면 animation 이 느려지고 짧게 하면 animation이 빨라 진다.
[UIView commitAnimations];
마지막으로 animation을 마무리 지어 주도록 하는 메소드이다.
'2013 이전 > iOS개발' 카테고리의 다른 글
[iOS 개발] 지역에 맞게 날짜 표기 하기 (0) | 2017.02.25 |
---|---|
[iOS 개발] iCloud keyValue Data Storage 사용 (0) | 2017.02.25 |
[iOS 개발] 간단한 animation 처리 (0) | 2017.02.25 |
[iOS 개발] UITableView 기본 delegate, datasource (0) | 2017.02.25 |
[iOS 개발] iCloud app 연동 설정 (0) | 2017.02.25 |
[iOS 개발] NSArray 역순으로 변환 (0) | 2017.02.25 |
댓글
2013 이전/iOS개발
[iOS 개발] UITableView 기본 delegate, datasourcehagulu 하구루2017. 2. 25. 16:19
UITableView 를 사용하다 보면 항상 기본적인 delegate와 datasource의 소스들을 다른 소스에서 긁어서 쓰고 있다.
#pragma mark - #pragma mark tableview delegate // 섹션의 갯수 - (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 5; } // 각 셀 그리기 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"CalendarCell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } return cell; } // 셀이 선택 되었을때 수행할 내용 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { } // 각셀의 높이 -(CGFloat) tableView : (UITableView *) tableView heightForRowAtIndexPath : (NSIndexPath *)indexPath{ return 45; }
'2013 이전 > iOS개발' 카테고리의 다른 글
[iOS 개발] iCloud keyValue Data Storage 사용 (0) | 2017.02.25 |
---|---|
[iOS 개발] 간단한 animation 처리 (0) | 2017.02.25 |
[iOS 개발] UITableView 기본 delegate, datasource (0) | 2017.02.25 |
[iOS 개발] iCloud app 연동 설정 (0) | 2017.02.25 |
[iOS 개발] NSArray 역순으로 변환 (0) | 2017.02.25 |
[iPhone 개발] string 이 URL 형식인지 확인하기 (0) | 2017.02.25 |
댓글
hagulu.com
.....
VISITED
Today : 2
Total : 179,440
Lately Post
Lately Comment