Skip to content

Instantly share code, notes, and snippets.

View scheinem's full-sized avatar

Manfred Scheiner scheinem

View GitHub Profile
@scheinem
scheinem / CodeForUIToolbarBugiOS8Beta5.m
Last active August 29, 2015 14:05
UIToolbar Bug iOS8 Beta 5 AND GM - UPDATE: Fix included!
// Execute the following code somewhere in your app
UIToolbar *datePickerToolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0.f, 50.f, self.window.bounds.size.width, 44.f)];
UIBarButtonItem *flexibleSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithTitle:@"Cancel" style:UIBarButtonItemStylePlain target:self action:nil];
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithTitle:@"OK" style:UIBarButtonItemStyleDone target:self action:nil];
datePickerToolbar.items = @[cancelButton, flexibleSpace, doneButton];
@scheinem
scheinem / tableViewEditActions.m
Last active September 26, 2019 05:23
iOS 8 beta 2: ''tableView:editActionsForRowAtIndexPath:"
- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewRowAction *moreAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"More" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
// show UIActionSheet
}];
moreAction.backgroundColor = [UIColor greenColor];
UITableViewRowAction *flagAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Flag" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
// flag the row
}];
@steipete
steipete / UITableViewMore.m
Last active January 29, 2018 14:19
Using the "More" button. Of course the simple way that Apple uses in Mail/iOS is not public. rdar://16600859
- (NSString *)tableView:(UITableView *)tableView titleForSwipeAccessoryButtonForRowAtIndexPath:(NSIndexPath *)indexPath {
return @"More";
}
- (void)tableView:(UITableView *)tableView swipeAccessoryButtonPushedForRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"I wanted to be a pretty public API, but then time ran out and they forgot me...");
// Hide the More/Delete menu.
[self setEditing:NO animated:YES];
}