Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am joaofranca on github.
  • I am joaofranca (https://keybase.io/joaofranca) on keybase.
  • I have a public key ASAWmAjYKAMVgys6SPkCc9Z327FAMQY0Xz3RSvMMyVX8wAo

To claim this, I am signing this object:

@joaofranca
joaofranca / gist:3159618
Created July 22, 2012 13:06
gist 7: iOS - Customize UITableViewCell delete/move overlay views while editing
- (void)layoutSubviews{
[super layoutSubviews];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:0.0f];
for (UIView *subview in self.subviews) {
@joaofranca
joaofranca / gist:3159590
Created July 22, 2012 13:04
gist 6: iOS - Customize UITableViewCell delete/move overlay views while editing
- (void)viewDidLoad{
[super viewDidLoad];
...
[table setDelegate:self];
[table setDataSource:self];
// enable editing mode
@joaofranca
joaofranca / gist:3159588
Created July 22, 2012 13:03
gist 5: iOS - Customize UITableViewCell delete/move overlay views while editing
// cells are movable
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath{
return YES;
}
@joaofranca
joaofranca / gist:3159585
Created July 22, 2012 13:02
gist 4: iOS - Customize UITableViewCell delete/move overlay views while editing
// update datasource after moving
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
// you should correct the data source order here to reflect the row moving
// it should be somethig like:
NSString * tmp = [sourceArray objectAtIndex:fromIndexPath.row];
[sourceArray removeObjectAtIndex:fromIndexPath.row];
[sourceArray insertObject:tmp atIndex:toIndexPath.row];
@joaofranca
joaofranca / gist:3159583
Created July 22, 2012 13:01
gist 3: iOS - Customize UITableViewCell delete/move overlay views while editing
// make cells editable
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
return YES;
}
@joaofranca
joaofranca / gist:3159582
Created July 22, 2012 13:00
gist 2: iOS - Customize UITableViewCell delete/move overlay views while editing
// cell content view indentation
- (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath{
return NO;
}
@joaofranca
joaofranca / gist:3159576
Created July 22, 2012 12:58
gist 1: iOS - Customize UITableViewCell delete/move overlay views while editing
// editing style
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath{
return UITableViewCellEditingStyleNone;
}
- (void) keyboardWillHide:(NSNotification *)nsNotification {
NSDictionary * userInfo = [nsNotification userInfo];
CGSize kbSize = [[userInfo objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
CGRect newFrame = [tableframe];
CGFloat kHeight = kbSize.height;
if(UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)){
- (void) keyboardDidShow:(NSNotification *)nsNotification {
NSDictionary * userInfo = [nsNotification userInfo];
CGSize kbSize = [[userInfo objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
CGRect newFrame = [table frame];
CGFloat kHeight = kbSize.height;
if(UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)){