封装的UITextField
2015-11-17 15:26
519 查看
/** * 封装输入框 * * @param frontTitle 前面的文字 * @param behindTitle placeholder的文字 * */ #pragma mark -封装输入框- -(UITextField*)createTheBoxView:(NSString*)frontTitle behindTitle:(NSString*)behindTitle{ UILabel*lab = [[UILabel alloc] init]; lab= [[UILabel alloc]initWithFrame:CGRectMake(AddPrizePadding30, 0,60+AddPrizePadding30, 100)]; lab.text = frontTitle; lab.textAlignment = NSTextAlignmentCenter; lab.font = [UIFont systemFontOfSize:AddPrizeFontSize30]; lab.contentMode = UIViewContentModeCenter; lab.textColor = UIColorFromRGB(0x33333); UITextField*tf = [[UITextField alloc] init]; tf = [[UITextField alloc]initWithFrame:CGRectMake(0, 0, 100,100)]; // tf.backgroundColor = [UIColor whiteColor]; tf.placeholder = behindTitle; tf.textColor =UIColorFromRGB(0xcccccc); tf.font = [UIFont systemFontOfSize:AddPrizeFontSize30]; tf.leftView = lab; tf.leftViewMode = UITextFieldViewModeAlways; return tf; }
UITextField*commodityNameTF = [[UITextField alloc] init]; commodityNameTF = [self createTheBoxView:@"商品名称" behindTitle:@"不能大于10个汉字"]; commodityNameTF.frame = CGRectMake(0, CGRectGetMaxY(oneLineLab.frame), UIScreenWidth, AddPrizeTFHeight); [self.view addSubview:commodityNameTF];
相关文章推荐
- UICollectionView创建 xib
- How to Back up and restore SharePoint 2013 using a VSS requestor
- UVA 题目10401 Injured Queen Problem(DP)
- Android 应用程序窗体显示状态操作(requestWindowFeature()的应用)
- iOS CoreBluetooth 教程
- leetcode #63 Unique PathsII
- leetcode #62 Unique Paths
- @PathVariable和@RequestParam
- 用SpriteBuilder简化"耕牛遍地走"的动画效果(四)
- 用SpriteBuilder简化"耕牛遍地走"的动画效果(四)
- 用SpriteBuilder简化"耕牛遍地走"的动画效果(四)
- Android中build target,minSdkVersion,targetSdkVersion,maxSdkVersion概念区分
- iOS中UIScrollView和UIPageControl以及NSTimer的综合使用
- UIPickerview循环滚动
- 转:Jmeter以non-gui模式进行分布式测试
- UILabel自适应文本,让文本自适应
- UI阻塞及其优化
- UIlable 适应字体大小
- rpmbuild spec文件的注释问题
- SpannableStringBuilder的妙用