uibutton - iOS Create Button with two separate labels -
i create button 2 independent labels. want set in 1 button, 2 separate texts in different colors. e.g.
[mybutton settitle: @"title" forstate: uicontrolstatenormal]; [mybutton settitle2: @"title2" forstate: uicontrolstatenormal];
is possible? maybe should need create new control? can me? grateful tutorial step step.
also, can :
uibutton *testbutton = [uibutton buttonwithtype:uibuttontypecustom]; testbutton.frame = cgrectmake(0, 0, 200, 40); [self.view addsubview:testbutton]; uilabel *firstlinetestbutton = [[uilabel alloc] initwithframe:cgrectmake(0, 0, 200, 20)]; firstlinetestbutton.text = @"first line"; firstlinetestbutton.font = [uifont systemfontofsize:12]; [testbutton addsubview:firstlinetestbutton]; uilabel *secondlinetestbutton = [[uilabel alloc] initwithframe:cgrectmake(0, 20, 200, 20)]; secondlinetestbutton.text = @"second line"; secondlinetestbutton.font = [uifont boldsystemfontofsize:12]; [testbutton addsubview:secondlinetestbutton];
but @vikingosegundo's solution more appropriate new sdk
Comments
Post a Comment