﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-ifeng-文章分类-iphone开发</title><link>http://www.cppblog.com/ifeng/category/16988.html</link><description /><language>zh-cn</language><lastBuildDate>Fri, 03 Jun 2011 19:11:35 GMT</lastBuildDate><pubDate>Fri, 03 Jun 2011 19:11:35 GMT</pubDate><ttl>60</ttl><item><title>UIWebView加上safari风格前进后退按钮</title><link>http://www.cppblog.com/ifeng/articles/147984.html</link><dc:creator>冷锋</dc:creator><author>冷锋</author><pubDate>Thu, 02 Jun 2011 14:46:00 GMT</pubDate><guid>http://www.cppblog.com/ifeng/articles/147984.html</guid><wfw:comment>http://www.cppblog.com/ifeng/comments/147984.html</wfw:comment><comments>http://www.cppblog.com/ifeng/articles/147984.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ifeng/comments/commentRss/147984.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ifeng/services/trackbacks/147984.html</trackback:ping><description><![CDATA[今天在写程序内打开网页的功能，写工具条的时候发现系统图标里面竟然没有后退按钮，，由于我这个是静态库工程，不可能自己弄张图上去，不然使用本库的时候还得附上图片，多杯具啊，经过一下午的搜索，终于找到个比较靠谱的，这哥们硬是用代码给画出来个箭头了，还是google管用啊，baidu非常非常非常。。。垃圾。
<div>
<h2><a title="Permanent Link: Code Example: Drawing the iPhone Back Button" href="http://outerlevel.com/blog/2008/12/26/code-example-drawing-the-iphone-back-button/" rel="bookmark">Code Example: Drawing the iPhone Back Button（转载）</a></h2>
<div>
<div><img src="http://outerlevel.com/blog/images/iPhoneBackButton.png" alt="" /></div>
<p>Recently, I had need to provide a back button similar to the one used in Mobile Safari for a consulting project.</p>
<p>Many of the buttons used in the built-in iPhone applications are made available via the SDK with built in button types and graphics. Unfortunately, the back button is not one of these.</p>
<p>Because I needed to display the toolbar button from inside a static library which can not include images, I had to render the back arrow directly in code.</p>
<p>Since this was a bit time consuming, I thought I would share in hopes that it saves someone else a little bit of time.</p>
<div>
<pre line="1">- (CGContextRef)createContext
{
// create the bitmap context
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef context = CGBitmapContextCreate(nil,27,27,8,0,
colorSpace,kCGImageAlphaPremultipliedLast);
CFRelease(colorSpace);
return context;
}
- (CGImageRef)createBackArrowImageRef
{
CGContextRef context = [self createContext];
// set the fill color
CGColorRef fillColor = [[UIColor blackColor] CGColor];
CGContextSetFillColor(context, CGColorGetComponents(fillColor));
CGContextBeginPath(context);
CGContextMoveToPoint(context, 8.0f, 13.0f);
CGContextAddLineToPoint(context, 24.0f, 4.0f);
CGContextAddLineToPoint(context, 24.0f, 22.0f);
CGContextClosePath(context);
CGContextFillPath(context);
// convert the context into a CGImageRef
CGImageRef image = CGBitmapContextCreateImage(context);
CGContextRelease(context);
return image;
}
- (UIBarButtonItem *)backButton
{
CGImageRef theCGImage = [self createBackArrowImageRef];
UIImage *backImage = [[UIImage alloc] initWithCGImage:theCGImage];
CGImageRelease(theCGImage);
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithImage:backImage
style:UIBarButtonItemStylePlain
target:self.webView
action:@selector(goBack)];
[backImage release], backImage = nil;
return [backButton autorelease];
}</pre>
</div>
</div>
</div><img src ="http://www.cppblog.com/ifeng/aggbug/147984.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ifeng/" target="_blank">冷锋</a> 2011-06-02 22:46 <a href="http://www.cppblog.com/ifeng/articles/147984.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>使用静态库时函数调用指向错误。</title><link>http://www.cppblog.com/ifeng/articles/147334.html</link><dc:creator>冷锋</dc:creator><author>冷锋</author><pubDate>Fri, 27 May 2011 01:23:00 GMT</pubDate><guid>http://www.cppblog.com/ifeng/articles/147334.html</guid><wfw:comment>http://www.cppblog.com/ifeng/comments/147334.html</wfw:comment><comments>http://www.cppblog.com/ifeng/articles/147334.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ifeng/comments/commentRss/147334.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ifeng/services/trackbacks/147334.html</trackback:ping><description><![CDATA[最近调试iphone项目时，发现使用静态库时调用函数A会直接跳到B函数去了，后来才发现原来使用静态库函数时是根据头文件的函数声明顺序去定位函数的，由于我的静态库的头文件的函数声明顺序跟使用库时添加的头文件里的函数声明顺序不一致，导致了杯具，网上搜索了下有些人说是按头文件来搜索函数的，有些人又说不是，莫非各个平台都不一样？求解答，有木有.<img src ="http://www.cppblog.com/ifeng/aggbug/147334.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ifeng/" target="_blank">冷锋</a> 2011-05-27 09:23 <a href="http://www.cppblog.com/ifeng/articles/147334.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>