码迷,mamicode.com
首页 > 其他好文 > 详细

asd

时间:2015-11-18 21:16:52      阅读:124      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!