首页 > 其他 > 详细

asd

时间:2015-11-18 21:16:16      阅读:310      评论:0      收藏:0      [点我收藏+]
- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        self.tintColor = [UIColor whiteColor];
    }
    return self;
}

-(void) layoutSubviews
{
    
    UITextField *searchField;
  NSUInteger numViews = [self.subviews count];
  for(int i = 0; i < numViews; i++) {
    if([[self.subviews objectAtIndex:i] isKindOfClass:[UITextField class]]) { //conform?
      searchField = [self.subviews objectAtIndex:i];
    }
  }
  if(!(searchField == nil)) {
        searchField.placeholder = @"输入要查找的艺人的名字";

        [searchField setBorderStyle:UITextBorderStyleRoundedRect];
        [searchField setBackgroundColor:[UIColor whiteColor]];

        //自己的搜索图标
        NSString *path = [[NSBundle mainBundle] pathForResource:@"GUI_search" ofType:@"png"];
        UIImage *image = [UIImage imageWithContentsOfFile:path];
    UIImageView *iView = [[UIImageView alloc] initWithImage:image];
        [iView setFrame:CGRectMake(0.0, 0.0, 30.0, 30.0)];
    searchField.leftView = iView;


  }
    
  [super layoutSubviews];
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

@end

 

asd

原文:http://www.cnblogs.com/dlwj/p/4975810.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!