方法一:利用偏移量来滚动- (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated;方法二:利用rect来滚动- (void)scrollRectToVisible:(CGRect)rect animated:(BO...
分类:
其他好文 时间:
2015-07-08 02:04:44
阅读次数:
500
1 /** 2 * 用来自定义imageView的尺寸和位置 (contentRect等于按钮的bounds) 3 */ 4 - (CGRect)imageRectForContentRect:(CGRect)contentRect { 5 return CGRectMake((co...
分类:
其他好文 时间:
2015-07-08 00:22:21
阅读次数:
146
- (CGRect)boundingRectWithSize:(CGSize)sizeoptions:(NSStringDrawingOptions)optionscontext:(NSStringDrawingContext*)context解释一下三个参数1) size用于限制尺寸,计算机绘制时...
分类:
其他好文 时间:
2015-07-07 12:28:38
阅读次数:
71
1.实线,(下划线/删除线)
写一个新类 UnderLineLabel :
UILabel
- (void)drawRect:(CGRect)rect {
// Drawing code
[super drawRect:rect];
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGSize f...
分类:
移动开发 时间:
2015-07-07 11:08:01
阅读次数:
253
CGRect frame=CGRectMake(0, 0, 0,
CGFLOAT_MIN);
self.tableView.tableHeaderView=[[UIView alloc]initWithFrame:frame];
CGFLOAT_MIN 这个宏表示 CGFloat 能代表的最接近 0 的浮点数,64 位下大概是 0.00(300左右个)0225 这个样子
这样写单纯...
分类:
移动开发 时间:
2015-07-06 14:17:04
阅读次数:
129
大家是否还记得对控件的frame/bounds/center进行属性更改时的三部曲?
1>将结构体取出
2>改变取出后的结构体对应的数据
3>将修改后的结构体赋值给控件
CGRect frame = self.view.frame;
// your code...
frame.origin.x = frameX;
// your code...
se...
分类:
移动开发 时间:
2015-07-06 10:23:25
阅读次数:
145
UIColor 转UIImage
- (UIImage*) createImageWithColor: (UIColor*) color
{
CGRect rect=CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
UIGraphicsBeginImageContext(rect.size);
CGContextRef c...
分类:
其他好文 时间:
2015-07-05 16:55:50
阅读次数:
160
主要代码如下://自定义导航栏返回按钮 self.navigationItem.leftBarButtonItem = ({ //导航栏返回背景视图 UIView *view = [[UIView alloc]initWithFrame:CGRect...
分类:
移动开发 时间:
2015-07-03 14:00:11
阅读次数:
238
LTView.h@interface LTView : UIView
{
UILabel *_lable;
UITextField *_textField;
}#pragma mark - 自定义初始化方法
- (instancetype)initWithFrame:(CGRect)frame
text:(NSString *)te...
分类:
其他好文 时间:
2015-07-03 00:19:46
阅读次数:
113
可以利用 CGMutablePathRef 创建每个不同图形,然后再一起添加到CGContext中- (void)drawRect:(CGRect)rect{ CGContextRef ctx = UIGraphicsGetCurrentContext(); //一、 画线 ...
分类:
Web程序 时间:
2015-07-02 20:48:18
阅读次数:
151