• <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 冷鋒 閱讀(3829) 評論(0)  編輯 收藏 引用 所屬分類: IOS開發(fā)
            今天在寫程序內打開網(wǎng)頁的功能,寫工具條的時候發(fā)現(xiàn)系統(tǒng)圖標里面竟然沒有后退按鈕,,由于我這個是靜態(tài)庫工程,不可能自己弄張圖上去,不然使用本庫的時候還得附上圖片,經(jīng)過一下午的搜索,終于找到個比較靠譜的,這哥們硬是用代碼給畫出來個箭頭了(話說如果是其他不規(guī)則的圖形要咋辦呢?),還是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 © 冷鋒

            精品久久亚洲中文无码| 2021久久精品国产99国产精品 | 亚洲国产天堂久久久久久| 久久综合久久自在自线精品自| 香蕉99久久国产综合精品宅男自| 青青青国产成人久久111网站| 国产精品99精品久久免费| 久久综合久久自在自线精品自| 无码人妻久久久一区二区三区| 中文字幕日本人妻久久久免费 | 久久久久亚洲AV片无码下载蜜桃| 久久久免费观成人影院| 国内精品伊人久久久久影院对白 | 国产精品久久影院| 嫩草影院久久国产精品| 亚洲国产精品久久久久网站| 国产午夜精品久久久久九九电影| 91精品日韩人妻无码久久不卡 | AV无码久久久久不卡蜜桃| 久久精品无码一区二区WWW| 91久久精品无码一区二区毛片| 色诱久久久久综合网ywww | 亚洲国产二区三区久久| 久久综合综合久久狠狠狠97色88| 精品久久久久久国产| 亚洲国产成人久久精品动漫| 伊人色综合久久| 综合久久精品色| 亚洲中文字幕无码一久久区| 伊人久久综在合线亚洲2019| AV色综合久久天堂AV色综合在| 亚洲性久久久影院| 狠狠色综合网站久久久久久久| 国产∨亚洲V天堂无码久久久| 久久久久av无码免费网| 亚洲国产高清精品线久久| 精品多毛少妇人妻AV免费久久| 久久久久国产一级毛片高清版| 精品国产91久久久久久久| 久久久久久久97| 精品久久久久久综合日本|