开发者

table view containg image view

i ve got an imageview ..below the imageview is a table view..which loads the data from server.by default five fields in table view are visible ..works fine..if i m to scroll the table view to view the remaining fields..the scroller rebounces..wat i want is the table view to be fixed and not to rebounce when scrolled ..i d be so greatful if u guys cud help me out..below is the code..

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 
{

   return 1;

}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
 {

return [items count];

}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section

{

 re开发者_开发问答turn 28.0;

}

- (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section 

{

UIView *headerView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 

tableViewteam.bounds.size.width, 28)] autorelease];

    headerView.backgroundColor=[UIColor colorWithPatternImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle]pathForResource:@"team"ofType:@"png"]]];

    return headerView;
}


- (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] autorelease];


}


    cell.selectionStyle=UITableViewCellSelectionStyleNone;

    cell.imageView.backgroundColor=[UIColor clearColor];

cell.textLabel.text=[[items objectAtIndex:indexPath.row]objectForKey:@"title"];

    cell.textLabel.textColor=[UIColor whiteColor];

    cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;

    return cell;
}


I didn't fully understand your problem. If you want to stop bouncing the table view you can add

yourTableView.bounces = NO;

in ViewDidLoad()


If you need your tableView to be fixed you can disable scrolling.

tableView.scrollEnabled = NO;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜