0

xibファイルにTableviewを追加しました(画像で確認できます)。tableviewはうまくロードされています。しかし、最後のセルが画面の外にあるため、上にスワイプすると最後のインデックスが表示されます。手を離すと最後のセルが出てこない。tableview の高さは変更しません。私の画面に固定しませんか?

このプロジェクトでは、facebook のような公開メニューを使用しています: https://github.com/mikefrederick/MFSideMenu

また、ムービーで問題を確認できます。

https://www.dropbox.com/s/usfwdhl5w9znkl6/IMG_0006.MOV

映画:

viewcontroller.h

@property(nonatomic,retain)IBOutlet UITableView * tableview;

viewcontroller.m

-(void)viewDidAppear:(BOOL)animated
{
     self.tableview.backgroundColor=[UIColor colorWithRed:(28/255.0) green:(28/255.0) blue:(28/255.0) alpha:1];
     [self.tableview setSeparatorColor:[UIColor blackColor]];

}
- (void)viewDidLoad
{
    [super viewDidLoad];




    if ([self respondsToSelector:@selector(edgesForExtendedLayout)])
        self.edgesForExtendedLayout = UIRectEdgeNone;

}
#pragma mark -
#pragma mark - UITableViewDataSource


- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 2;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if (section==0)
    {
        return 5;
    }
    if (section==1)
    {
        return 3;
    }
    return 0;
}

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

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }
    cell.textLabel.text =@"exampleCell";



    NSLog(@"cell.contentView.bounds.size.width %1.0f",cell.contentView.bounds.size.width);
    return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    if(section == 1)
        return 40;
    return 0;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
   self.tableview.layer.cornerRadius = 10.0f;
    tableView.layer.borderWidth = 2.0;
    tableView.layer.borderColor = [UIColor redColor].CGColor;
    return 60;


}
#pragma mark UITableViewDelegate
- (void)tableView: (UITableView*)tableView
  willDisplayCell: (UITableViewCell*)cell
forRowAtIndexPath: (NSIndexPath*)indexPath
{

    cell.backgroundColor =[UIColor colorWithRed:(41/255.0) green:(41/255.0) blue:(41/255.0) alpha:1];
    cell.textLabel.backgroundColor = [UIColor clearColor];
    cell.detailTextLabel.backgroundColor = [UIColor clearColor];
    if([indexPath row] == ((NSIndexPath*)[[tableView indexPathsForVisibleRows] lastObject]).row){
        //end of loading
        //for example [activityIndicator stopAnimating];

    }
}

- (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 30)];
    [headerView setBackgroundColor:[UIColor colorWithRed:(112/255.0) green:(112/255.0) blue:(112/255.0) alpha:1]];
    UILabel *titleLabel = [ [UILabel alloc] initWithFrame:CGRectMake(20, 0, 300, 44)];

    titleLabel.text = @"MÜŞTERİ ALANI";

    titleLabel.textColor = [UIColor whiteColor];

    titleLabel.backgroundColor = [UIColor clearColor];

    [headerView addSubview:titleLabel];
    return headerView;
}
4

3 に答える 3