首先要弄懂几个基本的概念。 一)三个结构体:CGPoint、CGSize、CGRect1.  CGPoint [plain]view plaincopy 1. /* Points. */ 2. 3. struct CGPoint { 4. CGFloat x; 5. CGFloat y; 6. }; 7. typedef str
CGRectMake 梳理
原创 2022-09-10 06:13:27
178阅读
# iOS 控件CGRectMake center 在iOS开发中,我们经常需要在屏幕上放置各种控件,比如按钮、标签、图像等。而CGRectMake和center是两个常用的方法,用于设置控件的位置和大小。本文将详细介绍这两个方法的使用,并提供一些示例代码。 ## CGRectMake CGRectMake是一个用于创建CGRect结构体的函数,它接受四个参数:x、y、width和heigh
原创 2023-12-20 06:29:15
132阅读
一、介绍CoreData不像slqite3那样编写代码繁琐,同时避免了使用了SQL语句的麻烦,也可以回避使用C语言的语法,降低了iOS开发的技术门槛。CoreData可降低开发成本,提高代码质量。它是一个完全面向对象的API,能够合理管理内存,负责在数据库中存储数据,底层也是由类似于SQL的技术实现的。CoreData是持久化存储的最佳方式,数据最终的存储类型可以是SQLite数据库、XML、二进
转载 2023-07-02 22:01:24
58阅读
我一般情况下不会使用interface builder去画界面,而是用纯代码去创建界面,不是装B,而是刚从vi转到xcode不久,不太习惯interface builder而已。当然如果需要我也会使用它。一个东西的存在没有绝对的好与坏,只是存在时间与空间决定了它的价值。(忘了讲了,我的环境是xcod...
转载 2015-11-08 11:48:00
40阅读
2评论
我一般情况下不会使用interface builder去画界面,而是用纯代码去创建界面,不是装B,而是刚从vi转到xcode不久,不太习惯interface builder而已。当然如果需要我也会使用它。一个东西的存在没有绝对的好与坏,只是存在时间与空间决定了它的价值。(忘了讲了,我的环境是xcod...
转载 2015-08-19 10:25:00
52阅读
2评论
一、初始化UILabel *myLabel = [[UILabel alloc] initWithFrame:CGRectMake(40, 40, 120, 44)]; [self.view addSubview:myLabel]; UILabel *myLabel = [[UILabel alloc] initWithFrame:CGRectMake(40, 40, 120,
转载 2023-10-11 16:58:19
674阅读
Creating a Geometric Primitive from Values //创建几何单元(点,尺寸,位置和尺寸) CGPointMake CGPoint CGPointMake (    CGFloat x,    CGFloat y ); CGRectMake CGRect CGRectMake ( &nbs
转载 精选 2012-09-04 13:31:14
859阅读
不要这样写:UIDatePicker *datePicker = [[UIDatePicker alloc] initWithFrame:CGRectMake(0, 0, 300, 200)];这样写分开写就可以改变大小了:UIDatePicker *datePicker = [[UIDatePicker alloc] init];datePicker.frame = CGRectMake
转载 2023-05-09 16:32:07
315阅读
UILabel 多行文字自动换行 (自动折行) 1.UIView *footerView = [[UIView alloc] initWithFrame:CGRectMake(10, 100, 300, 180)]; 2. UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(10, 100, 300, 150)];
转载 2024-10-08 06:54:07
20阅读
+ (UIImage *)addTwoImageToOne:(UIImage *)oneImg twoImage:(UIImage *)twoImg topleft:(CGPoint)tlPos{ UIGraphicsBeginImageContext(oneImg.size); [oneImg drawInRect:CGRectMake(0, 0, oneImg.size.width, oneImg.size.height)]; [twoImg drawInRect:CGRectMake(tlPos.x, tlPos.y, twoIm...
转载 2013-06-06 11:33:00
337阅读
2评论
//先自己写一个titleView UIView *titleView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 20)];//allocate titleView titleView.backgroundColor=[UIColor blackColor]; //Create UILable UILabel *titleText = [[UILabel alloc] initWithFrame: CGRectMake(100, 0, 50, 20)];//allocate titleText titleText...
转载 2013-07-02 19:56:00
49阅读
2评论
iPhone X 简直就是神一般的存在iPhone X的分辨率是:1125 X 2436 但是iPhone X的 UIScreen bounds 却是:CGRectMake(0, 0, 375, 812) #define isIphoneX CGRectEqualToRect([UIScreen mainScreen].bounds, CGRectMake(0, 0, 375, 812))其
转载 2024-08-15 15:14:43
82阅读
//手机号码textField    phoneNumTextField = [[UITextFieldalloc]initWithFrame:CGRectMake(
ico
原创 2023-05-09 16:21:39
156阅读
hithFrame:CGRectMake(40,0.0,240,30)];[mainView addSubview:t...
转载 2014-10-23 18:27:00
296阅读
2评论
创建TableView:UITableView *dataTable = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, 320,...
转载 2021-08-13 15:05:57
129阅读
UIView *view2 = [[UIView alloc] initWithFrame:CGRectMake(askPath = [UIBezierPath bezier
ii
原创 2023-05-09 16:12:41
115阅读
nitWithFrame:CGRectMake(10, 10, 80, 80)]; view.layer.cornerRadius = 10;
原创 2023-02-15 09:55:22
432阅读
//创建uilabel    UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(20, 40, 280, 80)
原创 2022-12-09 14:53:33
177阅读
在UIImage上加个1像素宽的透明边框UIImage*image = [UIImageimageNamed:@"cardBackDown.png"];CGRectimageRect =CGRectMake(0,0, image.size.width, image.size.height);UIGraphicsBeginImageContext(imageRect.size);[imagedrawInRect:CGRectMake(1,1,image.size.width-2,image.size.height-2)];image =UIGraphicsGetImageFr
转载 2012-03-06 14:43:00
596阅读
2评论
  • 1
  • 2
  • 3
  • 4
  • 5