jiakaihang's Blog

Happy coding

Customize UITableView Section View

jiakaihang posted @ 2012年12月11日 15:40 in 未分类 with tags UITableView Section Customize , 8182 阅读

Instead of using the normal method

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section

 

You want to implement this one:

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

As you can see, the second one returns a UIView instead of just string for text. Therefore you can customise your own view (with labels etc) and return it.

Here is an example of how you might do that (to be implemented in the above method:

// create the parent view that will hold header Label 
UIView* customView = [[[UIView alloc] initWithFrame:CGRectMake(10,0,300,60)] autorelease]; 

// create image object
UIImage *myImage = [UIImage imageNamed:@"someimage.png"];

// create the label objects 
UILabel *headerLabel = [[[UILabel alloc] initWithFrame:CGRectZero] autorelease];
headerLabel.backgroundColor = [UIColor clearColor];
headerLabel.font = [UIFont boldSystemFontOfSize:18];
headerLabel.frame = CGRectMake(70,18,200,20);
headerLabel.text = @"Some Text"; 
headerLabel.textColor = [UIColor redColor]; 

UILabel *detailLabel = [[[UILabel alloc] initWithFrame:CGRectZero] autorelease]; 
detailLabel.backgroundColor = [UIColor clearColor]; 
detailLabel.textColor = [UIColor darkGrayColor]; 
detailLabel.text = @"Some detail text"; 
detailLabel.font = [UIFont systemFontOfSize:12]; 
detailLabel.frame = CGRectMake(70,33,230,25); 

// create the imageView with the image in it 
UIImageView *imageView = [[[UIImageView alloc] initWithImage:myImage] autorelease]; 
imageView.frame = CGRectMake(10,10,50,50); 
[customView addSubview:imageView]; 
[customView addSubview:headerLabel]; 
[customView addSubview:detailLabel]; 
return customView;

 

Avatar_small
seo service london 说:
2024年1月16日 15:05

I am very glad to know that your site is upgrading from the with simplest to more faster and synchronized form. I am quite familiar of a lot of sites since I work as a freelance writer and one of the sites that I find evolve is your site respectively

Avatar_small
먹튀폴리스보증업체 说:
2024年2月05日 14:08

I was intrigued accepting that you at whatever point imagined of changing the plan of your site? Its very much made I genuinely like what you've got to say. However, no doubt you might somewhat more in the technique for material at some point so individuals could get along with it better.

Avatar_small
온라인카지노추천 说:
2024年2月05日 14:29

A good blog always comes-up with new and exciting information and while reading I have feel that this blog is really have all those quality that qualify

Avatar_small
토토사이트 说:
2024年2月05日 14:39

Nice to be visiting your blog again, it has been months for me. Well this article that i’ve been waited for so long. I need this article to complete my assignment in the college, and it has same topic with your article. Thanks, great share.

Avatar_small
메이저놀이터순위 说:
2024年2月05日 14:47

Hey. Very nice web site!! Guy .. Excellent .. Wonderful .. I will bookmark your website and take the feeds additionally…I am satisfied to locate numerous useful information right here within the post. Thank you for sharing..I am glad that it turned out so well and I hope it will continue in the future because it is so worthwhile and meaningful to the community.

Avatar_small
먹휴고 说:
2024年2月05日 14:56

I conceive you have mentioned some very interesting details , appreciate it for the post.

Avatar_small
안전놀이터추천 说:
2024年2月05日 15:08

Good post however I was wanting to know if you could write a litte more on this subject? I’d be very thankful if you could elaborate a little bit further. Cheers! Feel free to visit my website;

Avatar_small
먹튀사이트 说:
2024年2月05日 15:21

You might comment on the order system of the blog. You should chat it's splendid. Your blog audit would swell up your visitors. I was very pleased to find this site.I wanted to thank you for this great read!!

Avatar_small
토토사이트조회 说:
2024年2月05日 15:24

It’s my belief mesothelioma can be the most lethal cancer. It contains unusual characteristics. The more I look at it the greater I am certain it does not respond like a true solid tissues cancer. In the event mesothelioma is often a rogue virus-like infection, therefore there is the chance for developing a vaccine along with offering vaccination for asbestos open people who are really at high risk associated with developing future asbestos associated malignancies. Thanks for sharing your ideas about this important health issue

Avatar_small
먹튀검증커뮤니티 说:
2024年2月05日 15:33

It’s my belief mesothelioma can be the most lethal cancer. It contains unusual characteristics. The more I look at it the greater I am certain it does not respond like a true solid tissues cancer. In the event mesothelioma is often a rogue virus-like infection, therefore there is the chance for developing a vaccine along with offering vaccination for asbestos open people who are really at high risk associated with developing future asbestos associated malignancies. Thanks for sharing your ideas about this important health issue

Avatar_small
안전놀이터 说:
2024年2月05日 15:40

Wow! Such an amazing and helpful post this is. I really really love it. It's so good and so awesome. I am just amazed. I hope that you continue to do your work like this in the future also

Avatar_small
토토사이트 说:
2024年2月05日 15:44

I will recommend your website to everyone. You have a very good gloss. Write more high-quality articles. I support you.

Avatar_small
주간토토 说:
2024年2月05日 15:51

Wow, excellent post. I'd like to draft like this too - taking time and real hard work to make a great article. This post has encouraged me to write some posts that I am going to write soon.

Avatar_small
먹튀대피소 说:
2024年2月05日 15:58

Admiring the time and effort you put into your blog and detailed information you offer!..

Avatar_small
먹튀검증 说:
2024年2月05日 16:07

Admiring the time and effort you put into your blog and detailed information you offer!..

Avatar_small
안전토토사이트 说:
2024年2月05日 16:15

hi was just seeing if you minded a comment. i like your website and the thme you picked is super. I will be back.

Avatar_small
온라인카지노쿠폰 说:
2024年2月05日 16:22

Hello There. I found your blog using msn. This is an extremely well written article. I will be sure to bookmark it and return to read more of your useful information. Thanks for the post. I’ll certainly comeback.

Avatar_small
안전카지노사이트 说:
2024年2月05日 16:30

Nice information, valuable and excellent design, as share good stuff with good ideas and concepts, lots of great information and inspiration, both of which I need, thanks to offer such a helpful information here

Avatar_small
토토하이 说:
2024年2月05日 16:35

I just couldn't leave your website before telling you that I truly enjoyed the top quality info you present to your visitors? Will be back again frequently to check up on new posts.

Avatar_small
คาสิโน 说:
2024年2月05日 16:40

I just couldn't leave your website before telling you that I truly enjoyed the top quality info you present to your visitors? Will be back again frequently to check up on new posts.

Avatar_small
안전놀이터 说:
2024年2月05日 16:45

Cool stuff you have got and you keep update all of us.

Avatar_small
먹튀신고 说:
2024年2月05日 16:50

The Case For HIIT Cardio – Why You Should Concider it… By the way you might want to check out this cool site I found……

Avatar_small
먹튀신고 说:
2024年2月05日 17:02

I am always searching online for articles that can help me. There is obviously a lot to know about this. I think you made some good points in Features also. Keep working, great job!

Avatar_small
메이저놀이터 说:
2024年2月05日 17:06

Hey. Very nice web site!! Guy .. Excellent .. Wonderful .. I will bookmark your website and take the feeds additionally…I am satisfied to locate numerous useful information right here within the post. Thank you for sharing..I am glad that it turned out so well and I hope it will continue in the future because it is so worthwhile and meaningful to the community.

Avatar_small
먹튀신고 说:
2024年2月05日 17:10

Hey. Very nice web site!! Guy .. Excellent .. Wonderful .. I will bookmark your website and take the feeds additionally…I am satisfied to locate numerous useful information right here within the post. Thank you for sharing..I am glad that it turned out so well and I hope it will continue in the future because it is so worthwhile and meaningful to the community.

Avatar_small
먹튀검증 说:
2024年2月05日 17:17

I conceive you have mentioned some very interesting details , appreciate it for the post.

Avatar_small
슬롯 说:
2024年2月05日 17:47

Good post however I was wanting to know if you could write a litte more on this subject? I’d be very thankful if you could elaborate a little bit further. Cheers! Feel free to visit my website;

Avatar_small
카지노큐 说:
2024年2月05日 18:02

You might comment on the order system of the blog. You should chat it's splendid. Your blog audit would swell up your visitors. I was very pleased to find this site.I wanted to thank you for this great read!!

Avatar_small
엠카지노 说:
2024年2月05日 18:12

It’s my belief mesothelioma can be the most lethal cancer. It contains unusual characteristics. The more I look at it the greater I am certain it does not respond like a true solid tissues cancer. In the event mesothelioma is often a rogue virus-like infection, therefore there is the chance for developing a vaccine along with offering vaccination for asbestos open people who are really at high risk associated with developing future asbestos associated malignancies. Thanks for sharing your ideas about this important health issue

Avatar_small
토토사이트종류 说:
2024年2月05日 19:07

It’s my belief mesothelioma can be the most lethal cancer. It contains unusual characteristics. The more I look at it the greater I am certain it does not respond like a true solid tissues cancer. In the event mesothelioma is often a rogue virus-like infection, therefore there is the chance for developing a vaccine along with offering vaccination for asbestos open people who are really at high risk associated with developing future asbestos associated malignancies. Thanks for sharing your ideas about this important health issue

Avatar_small
카지노사이트이용후기 说:
2024年2月05日 19:17

That is the excellent mindset, nonetheless is just not help to make every sence whatsoever preaching about that mather. Virtually any method many thanks in addition to i had endeavor to promote your own article in to delicius nevertheless it is apparently a dilemma using your information sites can you please recheck the idea. thanks once more

Avatar_small
먹튀검증사이트 说:
2024年2月05日 19:23

Wow! Such an amazing and helpful post this is. I really really love it. It's so good and so awesome. I am just amazed. I hope that you continue to do your work like this in the future also

Avatar_small
먹튀신고 说:
2024年2月05日 19:28

I will recommend your website to everyone. You have a very good gloss. Write more high-quality articles. I support you.

Avatar_small
먹튀사이트조회 说:
2024年2月05日 19:36

Wow, excellent post. I'd like to draft like this too - taking time and real hard work to make a great article. This post has encouraged me to write some posts that I am going to write soon.

Avatar_small
안전놀이터 说:
2024年2月05日 19:42

Admiring the time and effort you put into your blog and detailed information you offer!..

Avatar_small
먹튀사이트 说:
2024年2月05日 19:48

Admiring the time and effort you put into your blog and detailed information you offer!..

Avatar_small
먹튀신고 说:
2024年2月05日 19:56

hi was just seeing if you minded a comment. i like your website and the thme you picked is super. I will be back.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter