最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

IOS圖片的原生(Graphics)詳解及實(shí)例

 更新時(shí)間:2017年05月16日 11:08:41   投稿:lqh  
這篇文章主要介紹了IOS圖片的原生(Graphics)詳解及實(shí)例的相關(guān)資料,需要的朋友可以參考下

IOS圖片的原生(Graphics)詳解及實(shí)例

一,效果圖。

二,工程圖。

三,代碼。

RootViewController.h

#import <UIKit/UIKit.h>

@interface RootViewController : UIViewController

@end
 

RootViewController.m

#import "RootViewController.h"

@interface RootViewController ()

@end

@implementation RootViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
  self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
  if (self) {
    // Custom initialization
  }
  return self;
}

- (void)viewDidLoad
{
  [super viewDidLoad];
  // Do any additional setup after loading the view.
  
  //背景圖
  [self addView];
  
}

#pragma -mark -functions
//背景圖
-(void)addView
{
  UIImageView *imageView=[[UIImageView alloc]initWithFrame:CGRectMake(50, 100, 44, 44)];
  imageView.image=[self defaultImage];
  [self.view addSubview:imageView];
}
//圖片原生
-(UIImage *)defaultImage {
  
  static UIImage *defaultImage = nil;
  static dispatch_once_t onceToken;
  dispatch_once(&onceToken, ^{
    UIGraphicsBeginImageContextWithOptions(CGSizeMake(20.f, 13.f), NO, 0.0f);
    
    [[UIColor blackColor] setFill];
    [[UIBezierPath bezierPathWithRect:CGRectMake(0, 0, 20, 1)] fill];
    [[UIBezierPath bezierPathWithRect:CGRectMake(0, 5, 20, 1)] fill];
    [[UIBezierPath bezierPathWithRect:CGRectMake(0, 10, 20, 1)] fill];
    
    [[UIColor whiteColor] setFill];
    [[UIBezierPath bezierPathWithRect:CGRectMake(0, 1, 20, 2)] fill];
    [[UIBezierPath bezierPathWithRect:CGRectMake(0, 6, 20, 2)] fill];
    [[UIBezierPath bezierPathWithRect:CGRectMake(0, 11, 20, 2)] fill];
    
    defaultImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    
  });
  return defaultImage;
}

- (void)didReceiveMemoryWarning
{
  [super didReceiveMemoryWarning];
  // Dispose of any resources that can be recreated.
}

感謝閱讀,希望能幫助到大家,謝謝大家對(duì)本站的支持!

相關(guān)文章

最新評(píng)論

西峡县| 科技| 房山区| 柳林县| 深圳市| 神木县| 松江区| 新郑市| 西安市| 海盐县| 石棉县| 淮阳县| 漯河市| 莆田市| 东源县| 万盛区| 富民县| 合川市| 奉化市| 灵璧县| 本溪市| 青海省| 绥德县| 永丰县| 霍山县| 台中市| 沧州市| 甘孜| 监利县| 东光县| 丰顺县| 礼泉县| 建德市| 高雄县| 潮州市| 彭水| 含山县| 辰溪县| 太保市| 辽中县| 南丰县|