我的UITableView
高于UITextField
。当我反复选择UITextField
UITableView
延伸时。这是我在onViewLoad上的代码:
- (void)viewDidLoad
{
[super viewDidLoad];
self.title = @"Clock In Time";
CALayer *layer= pickUpWeighCapacityList.layer;
UIColor* uic = UIColorFromRGB(0x336600);
CGColorRef* cgf = uic.CGColor;
layer.borderWidth = 2;
layer.borderColor = cgf;
layer.cornerRadius = 10;
layer.frame = CGRectMake(20.0f, 33.0f, 280.0f, 178.0f);
pickUpWeighCapacityList.dataSource = self;
pickUpWeighCapacityList.delegate = self;
pickUpWeighCapacityList.tableHeaderView = nil;
pickUpWeighCapacityList.tableFooterView = nil;
pickUpWeighCapacityList.frame = CGRectMake(20.0f, 33.0f, 280.0f, 178.0f);
i = 0;
signOutTimeField.placeholder = @"Time to Clock Out of Work";
picker = [[UIDatePicker alloc] init];
signOutTimeField.inputView = picker;
UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithTitle:@"Done"
style:UIBarButtonSystemItemDone target:self action:@selector(doneEditing)];
self.navigationItem.rightBarButtonItem = rightButton;
[rightButton release];
[picker release];
}
以下是我对视图功能的代码:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return 3;
}
如何让UITableView
不要伸展? (iOS 4.3.XCode 3.2.6 - 不要评判我)。
答案 0 :(得分:1)
解决方案不明显。在viewDidLoad
部分中,添加以下行:
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillHide:)
name:UIKeyboardWillHideNotification object:nil];
然后在viewController
中包含以下代码:
- (void)keyboardWillHide:(NSNotification *)note
{
[pickUpWeighCapacityList setFrame:
CGRectMake(original-x-coord,original-y-coord,
original-length,original-width)];
}