Сообщения

Find out, what controller is on the top.

If you want to check, what controller is on the top right now, with this code all what you need is to minimize app and restore it again. And you will see an alert with the title of Controller. APPDELEGATE #import "UIViewController+Top.h" - (void)applicationWillEnterForeground:(UIApplication *)application { #ifdef DEBUG     NSString *topController = NSStringFromClass([[UIViewController topViewController] class]);     [[[UIAlertView alloc] initWithTitle:topController     message:nil     delegate:self     cancelButtonTitle:@"Ok" otherButtonTitles:nil] show]; #endif } CATEGORY @interface UIViewController (Top) + (UIViewController *)topViewController; @end #import "UIViewController+Top.h" @implementation UIViewController (Top) + (UIViewController *)topViewController { UIViewController *rootViewController = [UIApplication sharedApplication].keyWindow.rootViewController; return [rootViewCont...

Xcode Swift Speed Up compilation

https://habrahabr.ru/post/317298/ //:configuration = Debug SWIFT_WHOLE_MODULE_OPTIMIZATION = YES http://stackoverflow.com/a/39477414/5790492 HEADERMAP_USES_VFS = YES http://stackoverflow.com/a/40580037/5790492 Unchecking "Find Implicit Dependencies" in Edit Scheme > "Scheme" > Build tab fixed it for me for project files. "Copy swift standard libraries" still takes forever.. http://stackoverflow.com/a/39864766/5790492 Not work, i think http://stackoverflow.com/a/40601731/5790492 Update  to Xcode 8.2

5/10/16 W

1) Xcode can run without build - Ctrl+Cmd+R 2) You can try pod example without cloning repo: pod try Google

Fr 05/09/16

1) How to start application in Xcode for different languages while testing.      In order to change default order of languages only for your XCode project, you can go to the Product > Scheme > Edit scheme, and add argument to "Run" scheme, for example: -AppleLanguages "(English,Russian)". 2) Go through all strings and take them to localizable.strings Type “cd ”, then drag in your project folder, then press enter to navigate to your project: find ./ -name "*.m" -print0 | xargs -0 genstrings -o en.lproj 3)  Git steps to create pull request Fork it! Create your feature branch:  git checkout -b my-new-feature Commit your changes:  git commit -am 'Add some feature' Push to the branch:  git push origin my-new-feature Submit a pull request :D

Mon 01/08/16

1) Disadvantage in using delegate of UITextField due to changing values in Cell's text fields.       If you have UITableView with UITextField in it's cells, you need to update it. There are some ways, and one of them to use UITextFieldDelegate like in example: func textField(textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -> Bool { if string == " " { return false } let indexPathForCellWhereTextFieldIs = self.tableView.indexPathForCell(textField.superview?.superview as! UITableViewCell) if indexPathForCellWhereTextFieldIs != nil { textFieldValues[(indexPathForCellWhereTextFieldIs?.section)!] = (textField.text! as NSString).stringByReplacingCharactersInRange(range, withString: string) as NSString as String } return true } So you have to check if  indexPathForCellWhereTextFieldIs  is'n nil.

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 Utiliti...