Bring up new window on swipe
Objective-C defines a small but powerful set of extensions to the ANSI C programming language that enables sophisticated object-oriented programming. Objective-C is the native language for Cocoa programming—it’s the language that the frameworks are written in, and the language that most applications are written in. You can also use some other languages—such as Python and Ruby—to develop programs using the Cocoa frameworks. It’s useful, though, to have at least a basic understanding of Objective-C because Apple’s documentation and code samples are typically written in terms of this language.
In this example, we will bring up a new window on a swipe event in a UITableView We will need 2 methods, one to recognize the event and another one to bring up the new window. We must instantiate a new UIViewController in order to bring up a new window and set the current view to the new view controller.
1 - ( NSArray * ) tableView 2 : ( UITableView * ) current_tableView 3 editActionsForRowAtIndexPath : ( NSIndexPath * ) text_idx 4 { 5 UITableViewRowAction * normal_action; 6 7 normal_action = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal 8 title:@"Some_Button_Title" 9 handler:^(UITableViewRowAction *new_action, NSIndexPath *indexPath) 10 { 11 [ self showNewView ] ; 12 } 13 ]; 14 15 return @[ normal_action ] ; 16 } 17 18 - ( void ) showNewView 19 { 20 UIViewController * new_viewController = [[UIViewController alloc] init]; 21 [self presentViewController:new_viewController animated:YES completion:nil]; 22 }