Elton's Blog

Tag: TTThumbsViewController

Three20中给TTPhotoViewController添加播放按钮

by on 二.06, 2010, under iPhone

Three20是一个很不错的iPhone类库,是facebook共享出来的框架。利用TTThumbsViewController可以很容易的制作出类似flickr的应用,实现缩略图和图片查看功能。

但是默认的TTThumbsViewController,点击一个图片的时候,下面的button只有上一个和下一个,并没有播放按钮。 之前以为Three20没有相应的播放功能。但是经过查看代码,发现在TTPhotoViewController中,其实有相关的方法,只是没有把播放按钮显示出来而已。

1
2
3
UIBarButtonItem* playButton = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:
    UIBarButtonSystemItemPlay target:self action:@selector(playAction)] autorelease];
  playButton.tag = 1;

通过修改TTPhotoViewController大致在400行左右,添加playButton这个变量

1
2
 _toolbar.items = [NSArray arrayWithObjects:
                   space, _previousButton, space, playButton, space, _nextButton, space, nil];

这样重新编译后,就可以看到播放按钮了。

Three20这个库其实还是很实用的,只是文档比较欠缺,没办法,只能直接看源码了。

6 Comments :, , , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit my friends!

A few highly recommended friends...