2012-10-24 55 views
2

我無法弄清楚如何構建這個按鈕。我在創建這個時需要幫助,請注意,當按鈕處於活動狀態時,條未被繪製。我應該使用哪些元素?創建硬定製按鈕

上的鏈接,你可以看看這個按鈕

http://i.stack.imgur.com/0mmJ0.png

UIButton *clone = [[UIButton alloc] initWithFrame:frame]; 
    [clone setTitle:strDate forState:UIControlStateNormal]; 
    [clone setTitleColor:[UIColor blackColor] forState:UIControlStateHighlighted]; 
    clone.frame = CGRectMake(19, post_offer_top*(i-1)+22, 281, 75); 
    clone.tag = my_id; 
    // [clone setTitle:[[buttons objectAtIndex:i-1] objectForKey:@"title"] forState:UIControlStateNormal]; 
    clone.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; 
    clone.contentEdgeInsets = UIEdgeInsetsMake(44, 31, 0, 0); 
    [clone setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; 
    [clone setTitleShadowColor:[UIColor whiteColor] forState:UIControlStateNormal]; 
    [clone.titleLabel setFont:[UIFont fontWithName:@"PF DinDisplay Pro" size:10]]; 
    [clone.titleLabel setShadowOffset:CGSizeMake(0.0f, 1.0f)]; 

什麼想法?

回答

1

你應該初始化這樣[UIButton的buttonWithType:UIButtonTypeCustom]按鈕

+0

所有圖標和文字 - 它的靜態背景?或者我應該使用2個子視圖? – user1771125