<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Sealyu

    --- 博客已遷移至: http://www.sealyu.com/blog

      BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
      618 隨筆 :: 87 文章 :: 225 評論 :: 0 Trackbacks

    Editor’s Note: You’ve seen the slick supercool gradient UITableView backgrounds, and this is how to make them quick and easy.  Thanks to Brett Romero of Cygen for this tutorial, ManiacDev.Com’s first submitted tutorial.  If you’ve created a quality, original tutorial that you think iPhone developers might want to read about please e-mail webmaster@maniacdev.com.
    - Johann Dowa, ManiacDev.Com
     
    This demonstration provides an example of how to spice up your UITableView rows for a more polished look. In addition to seeing how easy it can be to design a nice graphic for your iPhone app, you get a start to finish implementation.

    This video was embedded using the YouTuber plugin by Roy Tanck. Adobe Flash Player is required to view the video.
    The finished product is shown below.

     

    Rather than sticking with stock components included in Interface Builder, this demonstration shows a simple technique that gives your app a more professional look. As a developer, it can be difficult to create nice looking graphics for your app. Hiring a designer can quickly exceed the budget. However, creating some nice looking graphics is certainly achievable as a beginning designer. In addition to picking up some new great skills, a polished off UI can lend more creditability to your app and provide an overall better user experience.

    In the demo, Photoshop Elements is used, which is 80 bucks at adobe.com with a mail-in rebate. To get started, create a new image with these values:

    • Width: 80 pixels
    • Height: 40 pixels
    • Background Contents: Transparent

    Select a foreground color from the toolbar, as shown below:

     

     

    Now select the gradient button, as shown below:

     

     

    With the gradient selected, swipe from bottom to top on your image. This should produce a gradient color. Now choose File and “Save for Web”. You’ve just created the image we’ll use in our tableview. Let’s switch over to Xcode and implement the image.

    In Xcode, we start by creating a navigation based application.

    Once the application has been created, add the newly created image by right clicking the Resources folder then “Add” and “Existing Files”, as shown below:

     

     

     

     

    The following code snippet creates two views. Both are then added to the cell’s view. Because the label, which is a view, is added as the last view, we need to ensure its background is transparent (clearColor). Otherwise, it will cover part or all (depending on the size we set) of our background image. Thinking about what this stack of layers will look like, below is a screenshot of the same scenario in Interface Builder:

     

     

    From the screenshot, you can see the cell’s view owns the imageview and label. Although closer to the bottom, the label is actually top most to the user, hence the reason we need its background to clear.

    Let’s take a look at the implementation in Xcode, which is all done in the UITableView delegate method cellForRowAtIndexPath:.

    UIImage *image = [UIImage imageNamed:@"gradientcolor.png"];
    UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
    imageView.contentMode = UIViewContentModeScaleToFill;
    cell.backgroundView = imageView;
    [imageView release];
    UILabel *label = [[UILabel alloc] init];
    label.text = @"testing colors";
    label.frame = cell.bounds;
    label.backgroundColor = [UIColor clearColor];
    label.textAlignment = UITextAlignmentCenter;
    [cell addSubview:label];
    return cell;
    

    In the above snippet, we create an image object using the image we added to our app bundle. Next, we create a UIImageView object with the newly created image. The image view will be assigned to our cell’s background view. The backgroundView will retain an instance of the imageView. Therefore, we release our instance, as follows:

    [imageView release];
    

    If we had not released our instance, we’d have two instances of the imageView in memory and thus a memory leak. Moving on down in the code, we create an instance of a label. We set the label’s size to cover the entire cell. The label’s background is set to clear or transparent so it doesn’t hide the cell’s background image. Our assigned text is centered and finally, we add the label to the cell’s view, making it the top most view in the cell.

    posted on 2010-10-08 11:02 seal 閱讀(325) 評論(0)  編輯  收藏 所屬分類: iPhone
    主站蜘蛛池模板: 日本一道高清不卡免费| 99无码人妻一区二区三区免费 | 美女视频黄的全免费视频| 国产亚洲精品岁国产微拍精品| 国产免费A∨在线播放| 亚洲精品视频久久久| 九九免费久久这里有精品23| 亚洲午夜福利精品久久| 一级做a爱过程免费视| 国产亚洲精品精品国产亚洲综合| 国产A∨免费精品视频| 亚洲日韩精品无码专区网址 | 无码人妻一区二区三区免费手机 | 亚洲avav天堂av在线不卡| 日韩电影免费在线观看| 亚洲AV无码不卡在线播放| 最近最好最新2019中文字幕免费| 亚洲国产成人精品无码区在线网站| 免费看韩国黄a片在线观看| 亚洲人av高清无码| 亚洲乱亚洲乱少妇无码| 成全动漫视频在线观看免费高清版下载 | 亚洲国产一级在线观看| 国产精品偷伦视频观看免费| 中文字幕亚洲综合久久2| 无码专区永久免费AV网站 | 日韩a级无码免费视频| 亚洲成年人电影在线观看| 成人免费a级毛片无码网站入口 | 丁香婷婷亚洲六月综合色| 全黄a免费一级毛片人人爱| 成在人线av无码免费高潮喷水| 亚洲午夜电影在线观看| 亚洲国产综合无码一区二区二三区 | 免费日本黄色网址| 可以免费观看的毛片| 亚洲一本到无码av中文字幕| 中文字幕精品无码亚洲字| 免费看美女裸露无档网站| 一级毛片免费在线| 亚洲一区二区三区免费在线观看|