Elton's Blog

Tag: three20

Three20中给TTPhotoViewController添加播放按钮

by Elton on 2010年02月6日, under iPhone

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

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

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

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

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

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

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

5 Comments :, , , more...

iPhone开发库引用的问题

by Elton on 2009年12月23日, under iPhone

最近的项目用到了著名的Three20界面库, 程序发布完成结果背Apple拒绝,理由是使用了Private APIs, 没话说,肯定是Three20的问题。
于是获取最新代码,编译之后对可执行文件进行扫描确认没有Private APIs被调用了之后再build最终版本以提交App Store, 不知道是哪根筋不对突然觉得是否应该在真机上编译个release版本再提交,不然又要等若干天,万一被打回又得耽误功夫。
果然,一试吓一跳, 无法运行,原因是Three20中的所有对SDK种类的扩展都没被打包编译进来,运行时无法找到相应的selector,当然就crash了
开始是google搜寻答案,屡试之后,静下心来看看Three20的文档, 看到最后才恍然大悟,原来还需要一个 -all_load 连接选项。添加后编译运行,一切顺利, god。
然后翻阅水果文档,才知道 -all_load link option连接选项是告诉编译器将所连接的库全部包含,而不是用到才引入。

引自:http://www.flyblog.info/tag/three20

1 Comment :, 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...