0
これはかなりシンプルですが、私はこれを明確に説明できることを願って - 私はコンテナに挿入するテーブルビューがありますトップ/ボトムに達するとテーブルが跳ね返ります。これまでのところ、私はテーブルをコンテナに置くことができましたが、コンテナ内のテーブルがバウンスしている間はコンテナはビュー上に固定されていました。再び、コンテナにテーブルを固定する方法を探していますが、コンテナはバウンスしています。ここでどのように私はビュー内でバウンスするuitableviewコンテナを作ることができます
は、私は次のコード、やることができたものです。
私が達成したい何、その中にブラックボックスバウンスではなく、テーブルを持つことです。
のView Controllerの.mの私のviewDidLoad:あなたはそのためにUIScrollViewのを使用していない理由を
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
//General View Setup
UIColor *background = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"backgroundimage.png"]];
self.view.backgroundColor = background;
//Table View Data
listOfItems = [[NSMutableArray alloc] init];
NSArray *appleComputers = [NSArray arrayWithObjects:@"iPhone",@"iPod",@"MacBook",@"MacBook Pro",nil];
NSDictionary *appleComputersDict = [NSDictionary dictionaryWithObject:appleComputers forKey:@"Computers"];
NSArray *otherComputers = [NSArray arrayWithObjects:@"HP", @"Dell", @"Windows", @"Sony", @"Ivory", @"IBM", nil];
NSDictionary *otherComputersDict = [NSDictionary dictionaryWithObject:otherComputers forKey:@"Computers"];
[listOfItems addObject:appleComputersDict];
[listOfItems addObject:otherComputersDict];
self.navigationItem.title = @"Computers";
// Create a table
tblSimpleTable.delegate = self;
CGRect cgRct = CGRectMake(10, 50, 300, 300);
tblSimpleTable = [[UITableView alloc] initWithFrame:cgRct style:UITableViewStyleGrouped]; // Initilize the table
[tblSimpleTable setBackgroundColor:[UIColor blackColor]];
tblSimpleTable.sectionHeaderHeight = 30.0;
tblSimpleTable.sectionFooterHeight = 30.0;
tblSimpleTable.delegate = self;
tblSimpleTable.dataSource = self;
[self.view addSubview:tblSimpleTable];
//Create the header
UIView *containerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 300, 60)];
UILabel *headerLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 20, 300, 40)];
headerLabel.text = NSLocalizedString(@"Header for the table", @"");
headerLabel.textColor = [UIColor whiteColor];
headerLabel.shadowColor = [UIColor yellowColor];
headerLabel.shadowOffset = CGSizeMake(0, 1);
headerLabel.font = [UIFont boldSystemFontOfSize:22];
headerLabel.backgroundColor = [UIColor clearColor];
[containerView addSubview:headerLabel];
self.tblSimpleTable.tableHeaderView = containerView;
}
クールうわー本当にありがとうございました!マジックのように動作します! ++++ 1! – TommyG