自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

iOS源碼下載:實(shí)現(xiàn)自定義畫圖功能

移動(dòng)開發(fā)
實(shí)現(xiàn)了可自定義的畫圖功能,可以動(dòng)態(tài)選擇圖筆的顏色,線條粗細(xì)等。

支持平臺(tái):iOS

運(yùn)行環(huán)境:iOS

開發(fā)語言:Object-c

開發(fā)工具:Xcode

源碼大?。?66.12KB

源碼下載地址:http://down.51cto.com/data/1975550

源碼簡(jiǎn)介

實(shí)現(xiàn)了可自定義的畫圖功能,可以動(dòng)態(tài)選擇圖筆的顏色,線條粗細(xì)等。

源碼運(yùn)行截圖

效果圖

源碼片段

  1. - (id)initWithFrame:(CGRect)frame afterToolColor:(ToolColorBlock)toolcolor 
  2.     _toolColorBlock = toolcolor; 
  3.     self = [super initWithFrame:frame]; 
  4.     if (self) { 
  5.         self.backgroundColor = [UIColor lightGrayColor]; 
  6.         _colorArray = [NSArray array]; 
  7.         NSArray *array = @[[UIColor darkGrayColor], 
  8.                            [UIColor redColor], 
  9.                            [UIColor greenColor], 
  10.                            [UIColor blueColor], 
  11.                            [UIColor yellowColor], 
  12.                            [UIColor orangeColor], 
  13.                            [UIColor purpleColor], 
  14.                            [UIColor brownColor], 
  15.                            [UIColor blackColor]]; 
  16.   
  17.         _colorArray = array; 
  18.         [self creatColorButtons:array]; 
  19.     } 
  20.     return self; 
  21.   
  22. - (void)creatColorButtons:(NSArray *)array 
  23.     NSInteger count = array.count; 
  24.     CGFloat buttonW = (self.bounds.size.width - (array.count+1)*kButtonSpace)/count; 
  25.     CGFloat buttonH = self.bounds.size.height; 
  26.     for (NSInteger i = 0; i<array.count; i++)="" {="" uicolor="" *color="array[i];" uibutton="" *button="[UIButton" buttonwithtype:uibuttontypecustom];="" button.tag="i;" [button="" addtarget:self="" action:@selector(tagbutton:)="" forcontrolevents:uicontroleventtouchupinside];="" cgfloat="" buttonx="kButtonSpace" +="" i="" *="" (buttonw="" +kbuttonspace);="" button.frame="CGRectMake(buttonX," 5,="" buttonw,="" buttonh-10);="" setbackgroundcolor:color];="" [self="" addsubview:button];="" }="" -="" (void)tagbutton:(uibutton="" *)button="" [uiview="" animatewithduration:0.5f="" animations:^{="" self.frame="CGRectMake(0," -self.bounds.size.height,="" 320,="" 44);="" }];="" _toolcolorblock(_colorarray[button.tag]);="" }<="" pre=""
  27.                       
  28.                 </array.count;>

源碼下載地址:http://down.51cto.com/data/1975550

責(zé)任編輯:閆佳明 來源: 網(wǎng)絡(luò)整理
相關(guān)推薦

2013-06-27 11:10:01

iOS開發(fā)自定義UISlider

2023-07-21 19:16:59

OpenAIChatGPT

2012-07-24 15:03:19

OpenStack架構(gòu)

2013-07-18 16:09:10

自定義iOS狀態(tài)欄iOS開發(fā)iOS學(xué)習(xí)

2015-02-11 17:49:35

Android源碼自定義控件

2009-09-17 09:51:18

Eclipse JDT自定義跳轉(zhuǎn)

2010-04-30 09:32:49

ASP.NET MVC

2009-09-07 22:00:15

LINQ自定義

2022-05-18 07:44:13

自定義菜單前端

2012-06-01 11:02:33

2017-10-25 14:07:54

APPiOSxcode

2013-05-30 15:53:17

iOS開發(fā)iOS SDKPopver

2021-01-20 08:58:39

iOS 14桌面圖標(biāo)快捷指令

2011-08-02 11:17:13

iOS開發(fā) View

2015-01-22 15:59:07

Android源碼日期時(shí)間控件SelectTime

2009-04-23 09:05:08

IE8llq自定義功能

2015-02-12 15:33:43

微信SDK

2009-07-06 16:20:50

JSP自定義標(biāo)簽

2022-12-07 08:56:27

SpringMVC核心組件

2013-01-09 17:22:38

Android開發(fā)Camera
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)