uitableviewに接続されたカスタムUITableviewCellxibがあり、次のように実行します。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"MyCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
[[NSBundle mainBundle] loadNibNamed:@"MyCustomCell" owner:self options:nil];
cell = myCell;
self.myCell = nil;
}
[self configureCell:cell atIndexPath:indexPath];
return cell;
}
次に、デバイスの向きを変更するときに、カスタムUITableViewCellの要素の位置を変更したいので、このメソッドでは次のようにします。
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
if (UIInterfaceOrientationIsLandscape(toInterfaceOrientation)) {
CGRect myframe = CGRectMake(600, self.arrowLabel.frame.origin.y, self.arrowLabel.frame.size.width, self.arrowLabel.frame.size.height);
self.arrowLabel.frame = myframe;
} else {
CGRect myframe = CGRectMake(400, self.arrowLabel.frame.origin.y, self.arrowLabel.frame.size.width, self.arrowLabel.frame.size.height);
self.arrowLabel.frame = myframe;
}
}
UITableViewCell xibに接続されているarrowLabelのframe.origin.yとframe.origin.yを変更しますが、テーブルビューの最後の行の位置のみを変更します。他の行の他のラベルは同じ位置のままなので、質問は、テーブルビューをリロードする方法です。... [self.tableviewreloadData]も試しましたが...動作しません...何か考えはありますか?