• <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 © 冷鋒

            亚洲午夜无码AV毛片久久| 国产精品99久久久久久人| 99热精品久久只有精品| 亚洲精品无码久久毛片| 99久久免费国产精品热| 久久久久久久精品成人热色戒| 色欲综合久久躁天天躁蜜桃| 久久久国产精品| 久久九九有精品国产23百花影院| 超级97碰碰碰碰久久久久最新| 久久久久久久综合日本亚洲| 久久久久亚洲AV无码观看| 欧美麻豆久久久久久中文| 国产巨作麻豆欧美亚洲综合久久 | 久久黄视频| 久久99精品久久久久久9蜜桃| 69SEX久久精品国产麻豆| 欧美精品久久久久久久自慰| 亚洲AV无码一区东京热久久| 久久妇女高潮几次MBA| 久久99热只有频精品8| 999久久久无码国产精品| 狠狠色噜噜狠狠狠狠狠色综合久久 | 久久婷婷五月综合国产尤物app| 久久久久久伊人高潮影院| 国产69精品久久久久观看软件| 精品国产青草久久久久福利| 久久久久成人精品无码中文字幕| 亚洲精品蜜桃久久久久久| 国产精品9999久久久久| 欧美国产成人久久精品| 久久99精品国产麻豆| 久久青青色综合| 久久性精品| 青青草原综合久久大伊人导航| 久久精品99久久香蕉国产色戒| 久久久久国产成人精品亚洲午夜| 久久国产色AV免费观看| 欧洲精品久久久av无码电影| 亚洲国产精品久久久天堂| 女人高潮久久久叫人喷水|