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

            欧美伊人久久大香线蕉综合| 久久久久久国产精品免费免费| 亚洲精品无码专区久久同性男| 丁香久久婷婷国产午夜视频| 久久久久久av无码免费看大片| 99蜜桃臀久久久欧美精品网站| 一本一本久久aa综合精品| 久久精品国产亚洲AV嫖农村妇女| www性久久久com| 久久99国产精品尤物| 日本精品久久久中文字幕| 伊人久久大香线蕉综合Av | 国产精品无码久久综合| 久久99精品国产99久久6男男| 九九久久精品国产| 久久天堂AV综合合色蜜桃网| 激情五月综合综合久久69| 国产亚洲精久久久久久无码| 久久综合亚洲鲁鲁五月天| 久久精品中文字幕第23页| 久久福利青草精品资源站免费| 国产美女亚洲精品久久久综合| 久久夜色精品国产亚洲| 亚洲国产精品18久久久久久| 中文国产成人精品久久亚洲精品AⅤ无码精品 | 嫩草伊人久久精品少妇AV| 国产高潮国产高潮久久久91 | 亚洲日韩欧美一区久久久久我| 久久99国产综合精品免费| 99久久国产亚洲综合精品| 久久久久亚洲精品无码网址 | 久久久久亚洲AV无码永不| 亚洲伊人久久精品影院| 精品伊人久久大线蕉色首页| 午夜精品久久久久久| 久久99精品国产麻豆婷婷| 亚洲国产成人久久综合一| 久久久精品一区二区三区| 亚洲国产精品婷婷久久| 999久久久无码国产精品| 久久久久国产精品熟女影院|