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

IOS圖片的原生(Graphics)詳解及實(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.
}

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

相關(guān)文章

最新評論

兴安县| 华蓥市| 慈利县| 托里县| 行唐县| 七台河市| 公主岭市| 龙山县| 泰来县| 灵宝市| 和硕县| 固镇县| 沙河市| 曲阜市| 扶余县| 正阳县| 资源县| 贵州省| 阿克陶县| 青神县| 祁连县| 富阳市| 桓台县| 唐河县| 金乡县| 遂昌县| 阜平县| 阜新| 当涂县| 射阳县| 秦皇岛市| 香港 | 乾安县| 永丰县| 涡阳县| 兴和县| 广河县| 达孜县| 嘉鱼县| 开阳县| 平和县|