1

我是 iOS 开发的新手。我正在使用 XCode 4.5。当我运行项目时,我在情节提要中有一个 Button 和一个 UITableView 一切正常,但之后它停止更新设计,就像我在情节提要底部添加了一个工具栏但在我运行项目时它没有显示,我有检查了一切;更改按钮位置,TableView 位置,清理项目然后重建但没有效果......任何帮助将不胜感激......

MyViewController.h 

#import <UIKit/UIKit.h> 
@interface TweetifyViewController : UIViewController{ 
   IBOutlet UITableView *tweetsContainer;
   NSArray *tweets; 
   NSMutableData *data; 
}

- (IBAction)composeTweet:(id)sender; 
- (IBAction)viewMentions:(id)sender; 

@end

我的视图控制器.m

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
}


- (int)numberOfSectionsInTableView:(UITableView *)tableView
{
    return  1;
}

- (int)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [tweets count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
 {
        static NSString *customTableIdentifier = @"CustomTableCell";

        CustomTableCell *cell = (CustomTableCell *)[tableView dequeueReusableCellWithIdentifier:customTableIdentifier];
        if (cell == nil)
        {
            NSArray *nib = [[NSBundle mainBundle] loadNibNamed:customTableIdentifier owner:self options:nil];
            cell = [nib objectAtIndex:0];
        }

        cell.Name.text = [[[tweets objectAtIndex:indexPath.row] objectForKey:@"user"] objectForKey:@"name"];
        NSString *At = @"@";
        NSString *AtUserName = [[[tweets objectAtIndex:indexPath.row] objectForKey:@"user"] objectForKey:@"screen_name"];
    cell.userName.text = [NSString stringWithFormat:@"%@%@",At, AtUserName];
    NSData *imageData = [NSData dataWithContentsOfURL:imageURL];
    cell.avatar.image = [UIImage imageWithData:imageData];
    cell.tweetText.text = [[tweets objectAtIndex:indexPath.row] objectForKey:@"text"];

    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 120;
}


- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
4

1 回答 1

0

目前尚不清楚您在哪里添加了工具栏:

在故事板的底部

可能工具栏被放置在 tableView 下,所以选择它并在 menu 中Editor->Arrange->Send to front

于 2013-01-26T08:46:38.007 回答