在一個按鈕上單擊我顯示一個彈出視圖,這是一個tableview。popover tableview shows然後消失
一切似乎工作和視圖顯示,但然後消失在不到一秒鐘。
tableview包含一個字符串列表,我將tablecell設置爲顯示覆選標記。
我注意到,表顯示在分割第二它顯示
任何人都知道我錯過了什麼檢查所有項目。
感謝
哈桑
代碼以顯示酥料餅
- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqualToString:@"WholesalersList"]){
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
WholesalersViewController *vc = segue.destinationViewController;
vc.wholesalers = [appDelegate.wholesalers mutableCopy];
if ([segue isKindOfClass:[UIStoryboardPopoverSegue class]]){
self.wholesalersPopoverController = [(UIStoryboardPopoverSegue *)segue popoverController];
[self.wholesalersPopoverController setPopoverContentSize:CGSizeMake(334, 334)];
//[self.wholesalersPopoverController setDelegate:self];
}
}
}
代碼在酥料餅的tableview
#pragma mark Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)theTableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)theTableView numberOfRowsInSection:(NSInteger)section {
if ([self.wholesalers count] == 0) {
return 1;
}
else {
return [self.wholesalers count];
}
}
#pragma mark Table view delegate
- (UITableViewCell *)tableView:(UITableView *)theTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if ([self.wholesalers count] == 0) {
return nil;
}
else {
static NSString *CellIdentifier = @"WholesalerCell";
UITableViewCell *cell = [theTableView dequeueReusableCellWithIdentifier:CellIdentifier];
// Configure the cell.
Wholesaler *ws = (Wholesaler *)[self.wholesalers objectAtIndex:indexPath.row];
cell.textLabel.text = ws.name;
return cell;
}
}
- (CGFloat)tableView:(UITableView *)theTableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 44;
}
- (void)tableView:(UITableView *)theTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
}
- (void)tableView:(UITableView *)theTableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath {
}
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
return NO; // The table view should not be re-orderable.
}
沒有代碼,我們如何幫助您? – avignat
用代碼更新了問題。謝謝 –
謝謝soryngod使代碼看起來更好 –