Sealyu

--- 博客已迁移至: http://www.sealyu.com/blog

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  618 随笔 :: 87 文章 :: 225 评论 :: 0 Trackbacks

I’m back to programming and currently developing application for iPad. I needed something, what looked like a simplest thing – UITableView taking a portion of screen and SplitViewController wasn’t attractive option. To my surprise non of the obvious to me solutions worked until I’ve tried not-so-elegant reallocating of tableView.

So, in myTableViewController I created custom init function:

- (id) initWithFrame:(CGRect)frm {
if ((self = [super initWithStyle: UITableViewStylePlain])){
self.tableView = [[UITableView alloc] initWithFrame:frm style:UITableViewStylePlain];
}
return self;
}

Obviously, you can use default or your own init function or avoid passing frame argument and hardcode dimensions right here, but the magical line is:

self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(x, y, width, height) style:UITableViewStylePlain];

Well, at least it worked for me.

posted on 2010-10-08 10:40 seal 阅读(218) 评论(0)  编辑  收藏 所属分类: iPhone

只有注册用户登录后才能发表评论。


网站导航: