#import <QuartzCore/QuartzCore.h> [self.content.layer setBackgroundColor:[[UIColor whiteColor] CGColor]]; [self.content.layer setBorderColor:[[UIColor grayColor] CGColor]]; [self.content.layer setBorderWidth:1.0]; [self.content.layer setCornerRadius:8.0]; [self.content.layer setMasksToBounds:YES]; self.content.clipsToBounds = YES; // 商品标题 imputFeedBackTextView=[[UITextView alloc] initWithFrame:CGRectMake(20, 100, 280, 130)]; imputFeedBackTextView.font = [UIFont systemFontOfSize:15]; imputFeedBackTextView.backgroundColor = [UIColor whiteColor]; [self.view addSubview:imputFeedBackTextView]; imputFeedBackTextView.hidden=NO; imputFeedBackTextView.delegate = self; // 添加商品标题placeholder labelplaceHorder=[[UILabel alloc]initWithFrame:CGRectMake(25, 105,200,20)]; labelplaceHorder.text = @"请添加商品描述"; labelplaceHorder.font = [UIFont systemFontOfSize:15]; labelplaceHorder.textColor=[UIColor colorWithRed:200/256.0 green:200/256.0 blue:200/256.0 alpha:1]; // labelGoodsDescription.enabled = NO; // 设置为不可用 [imputFeedBackTextView.layer setBackgroundColor:[[UIColor whiteColor] CGColor]]; [imputFeedBackTextView.layer setBorderColor:[[UIColor colorWithRed:0.85 green:0.85 blue:0.85 alpha:1] CGColor]]; [imputFeedBackTextView.layer setBorderWidth:1.0]; [imputFeedBackTextView.layer setCornerRadius:6.0]; [imputFeedBackTextView.layer setMasksToBounds:YES]; imputFeedBackTextView.clipsToBounds = YES; [self.view addSubview:labelplaceHorder]; //实现UITextView的代理 -(void)textViewDidChange:(UITextView *)textView { if (imputFeedBackTextView.text.length == 0) { labelplaceHorder.text = @"请添加商品描述"; }else{ labelplaceHorder.text = @""; } }
时间: 2024-12-16 21:16:11