Created
September 6, 2011 18:22
-
-
Save chipp/1198512 to your computer and use it in GitHub Desktop.
custom view cell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ChildEditTableViewCell.h | |
// BabyBook | |
// | |
// Created by Vladimir Burdukov on 8/31/11. | |
// Copyright (c) 2011 __MyCompanyName__. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> | |
@interface ChildEditTableViewCell : UITableViewCell | |
@property (nonatomic, retain) UITableView *parentTableView; | |
@property (nonatomic, retain) UITextField *field; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ChildEditTableViewCell.m | |
// BabyBook | |
// | |
// Created by Vladimir Burdukov on 8/31/11. | |
// Copyright (c) 2011 __MyCompanyName__. All rights reserved. | |
// | |
#import "ChildEditTableViewCell.h" | |
@implementation ChildEditTableViewCell | |
@synthesize parentTableView, field; | |
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier | |
{ | |
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; | |
if (self) | |
{ | |
// Initialization code | |
} | |
return self; | |
} | |
- (void)setEditing:(BOOL)editing animated:(BOOL)animated | |
{ | |
[self setNeedsLayout]; | |
} | |
- (void)layoutSubviews | |
{ | |
[UIView beginAnimations:nil context:nil]; | |
[UIView setAnimationBeginsFromCurrentState:YES]; | |
[super layoutSubviews]; | |
CGRect contentFrame = self.contentView.frame; | |
contentFrame.origin.x = 10; | |
self.contentView.frame = contentFrame; | |
if (field) | |
if (((UITableView *)self.superview).isEditing) | |
field.userInteractionEnabled = YES; | |
else | |
field.userInteractionEnabled = NO; | |
[UIView commitAnimations]; | |
} | |
- (void)setSelected:(BOOL)selected animated:(BOOL)animated | |
{ | |
[super setSelected:selected animated:animated]; | |
// Configure the view for the selected state | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment