मैं जिसमें मैं एक कस्टम बटन है एक iPhone आवेदन बनाने रहा हूँ। मैंने लेबल बनाने और इसे सबव्यूव के रूप में जोड़कर बटन शीर्षक सेट किया है। अब जब बटन हाइलाइट किया गया है तो मैं लेबल टेक्स्ट रंग बदलना चाहता हूं।राज्य के लिए बटन लेबल पाठ रंग सेट करने के लिए कैसे UIControlStateHighlighted
यहाँ मेरी कोड है,
UIButton *button1= [UIButton buttonWithType:UIButtonTypeCustom];
[button1 setFrame:CGRectMake(68,162, 635, 101)];
[button1 setImage:[UIImage imageNamed:@"startwithouttext.png"] forState:UIControlStateNormal];
[button1 setImage:[UIImage imageNamed:@"startactivewithouttext.png"] forState:UIControlStateHighlighted];
UILabel *buttonLabel = [[UILabel alloc] initWithFrame:CGRectMake(button1.bounds.origin.x+50, button1.bounds.origin.y+20, button1.bounds.size.width-100, button1.bounds.size.height-40)];
[buttonLabel setFont:[UIFont fontWithName:@"Helvetica" size:28]];
buttonLabel.backgroundColor=[UIColor clearColor];
buttonLabel.textColor=[UIColor colorWithRed:83.0/255.0 green:83.0/255.0 blue:83.0/255.0 alpha:1.0];
buttonLabel.highlightedTextColor=[UIColor whiteColor];
buttonLabel.text = @"Long text string";
[button1 addSubview:buttonLabel];
[button1 bringSubviewToFront:buttonLabel];
[button1 setContentVerticalAlignment:UIControlContentVerticalAlignmentCenter];
[button1 setContentHorizontalAlignment:UIControlContentHorizontalAlignmentCenter];
[button1 addTarget:self action:@selector(button1clicked:) forControlEvents:
[mainView button1];
शरीर के किसी भी मदद कर सकते हैं मुझे पाठ रंग बदलने के लिए जब बटन हाइलाइट किया गया है?
के लिए कहा जाता है button1clicked है? – Maulik
हाँ button1clicked – krishan
कहा जाता है मैं पाठ का रंग बदल सकते हैं जब button1clicked विधि कहा जाता है, लेकिन क्या मैं चाहता हूँ पाठ का रंग बदलने के लिए जब बटन – krishan