0
嘗試將我的表視圖的邊界設置爲小於我的屏幕。我將其設置在viewDidLoad方法中,但運行時沒有任何反應。不知道爲什麼它不起作用。我是否在正確的地方稱它?xCode Tableview設置範圍
//OptionsViewController.m
- (void)viewDidLoad
{
[super viewDidLoad];
self.tableView.frame = CGRectMake(1,1,29,80);
}
// OptionsViewController.h
#import <UIKit/UIKit.h>
@interface OptionsViewController : UIViewController <UITableViewDataSource, UITableViewDelegate>
{
NSIndexPath *selectedRowIndex;
}
@property (weak, nonatomic) NSIndexPath *selectedRowIndex;
@property (weak, nonatomic) IBOutlet UITableView *tableView;
@end
你是不是也在故事板上拍桌子?如果是這樣的話,從故事板中刪除tableview並像編程viewDidLoad一樣以編程方式爲其指定界限。我只是問,因爲你已經把tableView的IBOutlet,並且如果你動態創建tableView,你不需要使用IBOutlet。 –