博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ios中键盘处理(二)
阅读量:7032 次
发布时间:2019-06-28

本文共 2643 字,大约阅读时间需要 8 分钟。

设置UIscrollview的背景代码

- (UIImage *) ImageWithColor: (UIColor *) color frame:(CGRect)aFrame{    UIGraphicsBeginImageContext(aFrame.size);    CGContextRef context = UIGraphicsGetCurrentContext();    CGContextSetFillColorWithColor(context, [color CGColor]);    CGContextFillRect(context, aFrame);        UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();    UIGraphicsEndImageContext();    return theImage;}
UIImage *image=[self ImageWithColor:[UIColor colorWithRed:240/255.0f green:240/255.0f blue:240/255.0f alpha:1] frame:self.view.bounds];       image= [image stretchableImageWithLeftCapWidth:image.size.width*0.5f topCapHeight:image.size.height*0.5f];    UIImageView *imageview=[[UIImageView alloc] initWithImage:image];    [scrollview addSubview:imageview];
 
动态生成控件
//封装UILabel +(UILabel*)LabWithFrame:(CGRect)_rect                    text:(NSString*)aText               textColor:(UIColor*)aColor               textAlign:(NSTextAlignment)aAlign                    font:(UIFont*)aFont{    UILabel *lab = [[[UILabel alloc] initWithFrame:_rect] autorelease];    lab.backgroundColor = [UIColor clearColor];    if ([aText length] > 0)         lab.text = aText;    if (aColor)        lab.textColor = aColor;    if(aAlign)        lab.textAlignment = aAlign;    if (aFont)        lab.font = aFont;    return lab;} //文本框
+(UITextField*)TextFieldWithFrame:(CGRect)_rect                           target:(id)target                             text:(NSString*)aText                        textColor:(UIColor*)aTextColor                        textAlign:(NSTextAlignment)aAlign                      placeHolder:(NSString*)holder                        clearMode:(UITextFieldViewMode)aViewMode{    UITextField *textField = [[[UITextField alloc] initWithFrame:_rect] autorelease];    textField.backgroundColor = [UIColor clearColor];    textField.delegate = target;        if (aAlign)        textField.textAlignment = aAlign;    if ([aText length] > 0)        textField.text = aText;    if (aTextColor)        textField.textColor = aTextColor;    if (aViewMode)        textField.clearButtonMode = aViewMode;    if ([holder length] > 0)        textField.placeholder = holder;    textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;        return textField;}
 
CGRect viewRect=self.view.bounds;    CGRect bRec,ftRec=self.view.bounds;    ftRec=UIEdgeInsetsInsetRect(viewRect, UIEdgeInsetsMake(Kpadding, Kpadding, Kpadding, Kpadding));        for (int i=0; i

 

 

TableView背景设置

 

 

 

UIImageView *tableBg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"XXX.png"]];

[yourTable setBackgroundView:tableBg];
[tableBg release];

 

 

 

转载地址:http://ktyal.baihongyu.com/

你可能感兴趣的文章
initWithImage和imageWithContentsOfFile的区别
查看>>
iOS 5 :一个UIPageViewController程序示例
查看>>
NSObject之一
查看>>
腾讯的微信小程序开发环境下常用快捷键汇总
查看>>
GeekBand 随笔分享(二)
查看>>
Spring AOP 知识点入门
查看>>
交换机端口安全
查看>>
Docker容器安装
查看>>
SpringMVC3.1.1+Spring3.1.1+Hibernate4+Velocity+EasyUI+ZTree实现RBAC基于角色的访问控制(一)...
查看>>
F5预测:移动支付已成主流
查看>>
solaris 10完全卸载cluster并重新安装
查看>>
小结:Windows Phone 7
查看>>
洛谷——P3905 道路重建
查看>>
我的友情链接
查看>>
打造高可用的DNS服务器——主从DNS服务器
查看>>
innobackupex实现MySQL数据库的备份与恢复
查看>>
取出网卡eth0的IP地址
查看>>
自主服务器详细发布网站教程,能上网即可以做网站服务
查看>>
mysql 主从同步情况跟踪记录
查看>>
Intel主板H110和B250,Z370的区别
查看>>