• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            UIWebView加上safari風格前進后退按鈕

            Posted on 2011-06-02 22:46 冷鋒 閱讀(3833) 評論(0)  編輯 收藏 引用 所屬分類: IOS開發
            今天在寫程序內打開網頁的功能,寫工具條的時候發現系統圖標里面竟然沒有后退按鈕,,由于我這個是靜態庫工程,不可能自己弄張圖上去,不然使用本庫的時候還得附上圖片,經過一下午的搜索,終于找到個比較靠譜的,這哥們硬是用代碼給畫出來個箭頭了(話說如果是其他不規則的圖形要咋辦呢?),還是google管用啊,baidu非常非常非常。。。垃圾。

            Code Example: Drawing the iPhone Back Button(轉載)

            Recently, I had need to provide a back button similar to the one used in Mobile Safari for a consulting project.

            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.

            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.

            Since this was a bit time consuming, I thought I would share in hopes that it saves someone else a little bit of time.

            - (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];
            }

            posts - 15, comments - 18, trackbacks - 0, articles - 0

            Copyright © 冷鋒

            亚洲午夜久久久久久噜噜噜| 国产精品一久久香蕉国产线看 | 91精品久久久久久无码| 丁香狠狠色婷婷久久综合| 日本久久久精品中文字幕| 欧美成a人片免费看久久| 久久亚洲精品视频| 久久人人爽人人爽人人片AV东京热| 日韩美女18网站久久精品| 色婷婷综合久久久久中文| 精品久久久久久国产三级| 亚洲va久久久噜噜噜久久狠狠| 久久亚洲国产精品一区二区| 亚洲精品视频久久久| 国产日韩欧美久久| 久久国产精品99国产精| 中文字幕热久久久久久久| 国产精品美女久久久久AV福利| 久久丫精品国产亚洲av| 人人妻久久人人澡人人爽人人精品| 91精品国产色综合久久| 伊人久久精品无码av一区| 久久免费99精品国产自在现线| 国产亚洲美女精品久久久久狼| 精品无码久久久久国产动漫3d| 欧美国产成人久久精品| 国产综合免费精品久久久| 青青国产成人久久91网| 国内精品久久国产大陆| 久久精品www人人爽人人| 色狠狠久久AV五月综合| 色欲av伊人久久大香线蕉影院| 老男人久久青草av高清| 久久午夜福利无码1000合集| 亚洲第一永久AV网站久久精品男人的天堂AV | 狠狠色丁香久久婷婷综合五月| 亚洲精品无码久久久影院相关影片 | 久久99精品久久久久久不卡| 久久久久无码精品国产app| 伊人久久成人成综合网222| 亚洲欧美精品一区久久中文字幕|