- (void) scrollViewDidScroll:(UIScrollView *)scrollView{ CGPoint offset = scrollView.contentOffset; // 当前滚动位移 CGRect bounds = scrollView.bounds...
分类:
其他好文 时间:
2014-08-05 15:32:49
阅读次数:
207
改变UITextField placeHolder颜色、字体我们有时需要定制化UITextField对象的风格,可以添加许多不同的重写方法,来改变文本字段的显示行为。这些方法都会返回一个CGRect结构,制定了文本字段每个部件的边界范围,甚至修改placeHolder颜色,字体。– textRect...
分类:
其他好文 时间:
2014-08-04 13:56:27
阅读次数:
217
我们常常需要用到按钮需要文字和图片同时显示,例如:
我们需要定义一个UIButton的子类
实现文件
- (id)initWithFrame:(CGRect)frame
{
self = [super
initWithFrame:frame];
if (self) {
//可根据自己的需要随意调整
...
分类:
移动开发 时间:
2014-07-26 02:57:06
阅读次数:
265
UIScreen对象包含了整个屏幕的边界矩形。当构造应用的用户界面接口时,你应该使用该对象的属性来获得推荐的矩形大小,用以构造你的程序窗口。CGRect bound = [[UIScreen mainScreen] bounds]; // 返回的是带有状态栏的Rect CGRect frame = ...
分类:
其他好文 时间:
2014-07-26 00:38:26
阅读次数:
258
//一定要重写UIView类中的-(void)drawRect:(CGRect)rect方法才能画线;//绘制UIView-(void)drawRect:(CGRect)rect{[selfdrawLine];}/***画线*/-(void)drawLine{//1.获取上下文CGContextRefcontext=UIGraphicsGetCurrentContext();//2.创建可变的路径并设置路径CGMutablePathRef..
分类:
移动开发 时间:
2014-07-24 17:58:37
阅读次数:
226
iOS 使用drawRect: 绘制虚线椭圆1:首先如果要使用 drawRect 绘图 要导入CoreGraphics.framework 框架 然后 创建 自定义view, 即是 myView继承 UIView;2: 重写- (void)drawRect:(CGRect)rect方法;3:添加.....
分类:
移动开发 时间:
2014-07-24 17:14:45
阅读次数:
343
`1.CGRectInset````CGRect CGRectInset ( CGRect rect, CGFloat dx, CGFloat dy);````return rect which is smaller or larger than the source with the...
分类:
其他好文 时间:
2014-07-24 05:05:48
阅读次数:
264
近期想做一个跑马灯的效果,于是写出了如下的跑马灯效果的代码。。。但是调试发现,在iOS6下动画是可以执行的,但是在iOS7下动画并不执行,没有达到预期的效果。
[_scrollLabel sizeToFit];
CGRect frame = _scrollLabel.frame;
frame.origin.x = 320;
_scrollLabel.frame = fra...
分类:
移动开发 时间:
2014-07-18 11:18:16
阅读次数:
208
#import "MJcostom.h"@implementation MJcostom- (id)initWithFrame:(CGRect)frame{ self = [super initWithFrame:frame]; if (self) { self.backgroundColor=[U...
分类:
其他好文 时间:
2014-07-16 16:03:21
阅读次数:
196
- (id)initWithFrame:(CGRect)frame{ if(self= [superinitWithFrame:frame]) { // Important here, rotate THIS UIView [selfsetCenter:CGPointMake(160...
分类:
其他好文 时间:
2014-07-16 15:26:52
阅读次数:
149