Сообщения

Сообщения за июль, 2016

Wen 27/07/16

1) In viewWill/DidDisappear methods place code before [super ...].       - (void)viewWillDisappear:(BOOL)animated {     if ([self.navigationController.viewControllers indexOfObject:self] == NSNotFound)          {             [self.view.window endEditing:YES];              self.navigationController.toolbarHidden = YES;           }      [super viewWillDisappear:animated];  }

Tue 26/07/16

Изображение
1) How to select the row for default in UITableView.       First way in ViewDidLoad: //select first cell for default self.clearsSelectionOnViewWillAppear = NO; //if you use UITableViewController (delete if you use UIViewController NSIndexPath *indexPath = [NSIndexPath indexPathForRow:2 inSection:0]; [self.tableView selectRowAtIndexPath:indexPath animated:NO scrollPosition:UITableViewScrollPositionNone];     Second modern way: tableView . remembersLastFocusedIndexPath = Yes ; - ( NSIndexPath *) indexPathForPreferredFocusedViewInTableView :( UITableView *) tableView From here . 2) How to use scrollView without ContentView     First of all select elements in .xib that you want to place at scrollView. Embed it in ScrollView from menu like at screen. Constrain ScrollView to UIView bounds. Constrain elements in ScrollView like you do it in regular UIView. (Maybe you have to use "Freeform" setting in Utilities editor for reasons of

Mon 07/26/16

1) How to change section header's titleLabel attributes.       From iOS 7.0 instead of using viewForHeaderInIndexPath... you can use - (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section {     UITableViewHeaderFooterView *header = (UITableViewHeaderFooterView *)view;     header.textLabel.font = [UIFont fontWithName:@"Roboto" size:20];     header.textLabel.textAlignment = NSTextAlignmentCenter; }

Fr 07/22/16

1) How to convert NSInteger to String in modern Objective-C.       You can forget about  NSString *inStr = [NSString stringWithFormat: @"%ld", (long)month]; Use this: NSInteger value = x ; NSString * string = [@( value ) stringValue ]; Here @( value ) converts the given NSIntegert to NSNumber object from which you get the desired type . 2) How to  amazingly close keyboard without any code.      Here 3) Difference between search bar and search display controller.

Thr 07/21/16

Изображение
1) How to use a storyboard for single app controller. I met a problem when decided to use static cells. They can't be implemented in .xib files, but only in .storyboard. Due to get over this you should do next: Create storyboard file and UITableViewController in his workspace. Choose class and ID. Where class is a custom UITableViewController class and ID is custom string. In parent ViewController use this code: UIStoryboard *appSettingsStoryboard = [UIStoryboard storyboardWithName:@"NKVAppSettings" bundle:nil]; NKVSettingsTVC *appSettingsTVC = [appSettingsStoryboard instantiateViewControllerWithIdentifier:@"appSettingsID"]; [self.navigationController pushViewController:appSettingsTVC animated:YES]; 2) Invisible elements in UITableViewCells It's very interestin g, that when you use UITableViewCell class's elements (like  textLabel ) and Custom inherited  UITableViewCell's class elements. So you should or

Wen 07/20/16

Изображение
1) How to compare two folders in OSx. diff -rq '/firstFolderPath' '/secondFolderPath' In terminal; -rq means to search in subfolders and print short description. Example :  diff -rq '/Users/nikkov/Desktop/First' '/Users/ nikkov /Desktop/Second' 2) How to watch view hierarchy. NSLog(@"%@", [self.view recursiveDescription]); 3) How to exclude some files from compilation in Xcode. Target -> Build Settings -> Add User-Defined Setting -> Type "EXCLUDED_SOURCE_FILE_NAMES". In line's window type something like *.mm, *.h.

Tue 07/19/16

1) Xcode compilator revolution: Xcode 4: LLVM-GCC for default, but GCC still available. Xcode 4.2: LLVM 3.0 for default, GCC expropriated. Xcode 4.6: update to LLVM 4.2.  Xcode 5:  update to LLVM 5.0,  LLVM-GCC expropriated. GCC to LLVM transition completed. 2) How to integrate Unity into iOS app. https://github.com/armandsLa/ios-unity5-objc : Objective-C https://github.com/blitzagency/ios-unity5 : Swift https://github.com/keyv/iOSUnityVuforiaGuide https://bitbucket.org/jack_loverde/unity-5-vuforia-6-and-ios-native-integration 3) How send data between Unity and iOS app. http://alexanderwong.me/post/29861010648/call-objective-c-from-unity-call-unity-from Integration of Unity: 1) Скопировать папки Classes и Libraries (Create groups). Добавить Data (Create folder references); 2) Удалить ссылки на все .h в папке Classes/Native и удалить папку Libraries/libil2cpp (Remove references); 3) Изменить код в UnityAppController.h; inline UnityAppController* GetAppCont

Mon 07/18/16

1) subspec in podfile: s.subspec ' AFURL ' do | subspec | subspec.dependency ' ImageSlideshow/Core ' subspec.dependency ' AFNetworking ' , ' ~> 3.0 ' subspec.source_files = ' Pod/Classes/InputSources/AFURLSource.swift ' end s.subspec ' Alamofire ' do | subspec | subspec.dependency ' ImageSlideshow/Core ' subspec.dependency ' AlamofireImage ' , ' ~> 2.0 ' subspec.source_files = ' Pod/Classes/InputSources/AlamofireSource.swift ' end s.subspec ' SDWebImage ' do | subspec | subspec.dependency ' ImageSlideshow/Core ' subspec.dependency ' SDWebImage ' , ' ~> 3.8 ' subspec.source_files = ' Pod/Classes/InputSources/SDWebImageSource.swift ' end ---------------- 2)  Only necessary in Pod: pod 'ImageSlideshow/SDWebImage', :git => ' https://github.com/zvonicek/ ImageSlideshow.git ' 3) Parting by conditions.