直接上代码,如下:
/**
* 获取字符串的宽度和高度
*
* @param text:NSString
* @param font:UIFont
*
* @return CGRect
*/
class
func getTextRectSize(text:NSString,font:UIFont,siz...
分类:
编程语言 时间:
2015-08-19 20:33:41
阅读次数:
300
我一般情况下不会使用interface builder去画界面,而是用纯代码去创建界面,不是装B,而是刚从vi转到xcode不久,不太习惯interface builder而已。当然如果需要我也会使用它。一个东西的存在没有绝对的好与坏,只是存在时间与空间决定了它的价值。(忘了讲了,我的环境是xcod...
样式展示.h文件#import @interface NALLabelsMatrix : UIView { NSArray *columnsWidths; uint numRows; uint dy;}- (id)initWithFrame:(CGRect)frame andColumnsWi...
分类:
其他好文 时间:
2015-08-18 15:42:24
阅读次数:
114
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
UIView * v = [[UIView alloc] initWithFrame:CGRect...
分类:
其他好文 时间:
2015-08-17 21:54:16
阅读次数:
6214
一:UITableView的几个重要属性 1,style样式, 在初始化时设置 - (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style; 其中UITableViewStyle枚举类型为: ...
分类:
其他好文 时间:
2015-08-15 22:44:07
阅读次数:
276
·UILable是iPhone界面最基本的控件,主要用来显示文本信息。·常用属性和方法有:1、创建CGRect rect = CGRectMake(100, 200, 50, 50);UILabel *label = [[UILabel alloc] initWithFrame:rect];2、te...
分类:
移动开发 时间:
2015-08-14 22:43:04
阅读次数:
254
有了view的子类,只要重载一个方法drawRect-(void)drawRect:(CGRect)aRect;它的参数是个矩形,这个矩形就是你要重绘的区域,你可以忽略参数,它只是为了性能优化,只在固定的区域绘图.注意!!!永远不要去调用drawRect,因为drawRect不是让你调用的,而是系...
分类:
其他好文 时间:
2015-08-14 13:33:36
阅读次数:
137
1 UITabBarController *tabBarController =[[UITabBarController alloc] init];2 CGRect frame = self.window.bounds;3 tabBarController.tabBar.frame ...
分类:
其他好文 时间:
2015-08-13 13:48:31
阅读次数:
141
#import "ViewController.h"
@interface ViewController ()
{
UIView *bgView;
UITextView *inputView;
CGRect keyBoardRect;
NSMutableArray *allContent;
}
@end
...
分类:
移动开发 时间:
2015-08-11 16:16:17
阅读次数:
158
我们有时需要定制化UITextField对象的风格,可以添加许多不同的重写方法,来改变文本字段的显示行为。这些方法都会返回一个CGRect结构,制定了文本字段每个部件的边界范围,甚至修改placeHolder颜色,字体。– textRectForBounds: //重写来重置文字区域– drawT....
分类:
其他好文 时间:
2015-08-11 15:41:45
阅读次数:
174