• <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 冷鋒 閱讀(3846) 評論(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 © 冷鋒

            久久久精品免费国产四虎| 久久精品国产99国产精品亚洲| 久久99精品国产麻豆宅宅| 99久久精品费精品国产| 亚洲伊人久久成综合人影院| 久久久老熟女一区二区三区| 97超级碰碰碰久久久久| 久久久久波多野结衣高潮| 久久99国产精品久久99| 久久精品国产免费观看| 久久精品国产亚洲一区二区三区| 精品久久亚洲中文无码| 欧美日韩精品久久久久| 久久国产免费观看精品| 亚洲国产精品无码久久久不卡 | 久久免费看黄a级毛片| 99久久777色| 丰满少妇高潮惨叫久久久| 久久亚洲AV无码精品色午夜| 久久久久久无码国产精品中文字幕| 国产国产成人精品久久| 亚洲AV日韩AV天堂久久| 国产精品一区二区久久精品涩爱| 久久久久四虎国产精品| 好久久免费视频高清| 精品久久久久久中文字幕| 色欲综合久久躁天天躁蜜桃| 狠狠色婷婷久久综合频道日韩 | 一本一本久久A久久综合精品| 久久这里有精品视频| 久久影视综合亚洲| 日韩久久无码免费毛片软件| 久久久久久国产精品美女| 精品久久久久久无码免费| 久久精品亚洲福利| 久久久久99精品成人片牛牛影视| 国产亚洲成人久久| 亚洲国产精品无码久久久久久曰| 亚洲国产天堂久久综合| 亚洲色欲久久久综合网东京热| 欧美精品久久久久久久自慰|