views:

48

answers:

3

how to push button and button name change and agin pus find same name in iphone

A: 

Do some research on google.Type in "Setting UIButton title".Thats i how i got it

Mithun Madhav
I'd try something like this: UIButton *myButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; myButton.frame = CGRectMake(20, 20, 200, 44); // position in the parent view and set the size of the button [myButton setTitle:@"Click Me!" forState:UIControlStateNormal]; // add targets and actions [myButton addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside]; // add to a view [superView addSubview:myButton];
VK RAJ
A: 

I have written the code that you can use on the click event of the button to change its title from oldTitle to NewTitle on Click and again cage the code from NewTitle to OldTitle on another click.

BOOL isOne;
-(void) buttonClicked
{
    if(!isOne)
    {
        [callsButton setTitle:@"NewTitle" forState:UIControlStateNormal];
            isOne=YES;
    }
    else
    {
        [callsButton setTitle:@"OldTitle" forState:UIControlStateNormal];
            isOne=NO;
    }
//YOUR STUFFS HERE
}

hAPPY cODING...

Suriya
thanks...............
VK RAJ
wlcm.... But getting a vote is the best thanks :P
Suriya
i m try but i m not success
VK RAJ
dats because you dont have enough points to vote.. no worries atleast you can tick the answer as correct if it has helped you..
Suriya
A: 

to change the title of the UIButton use below code...

[myButton setTitle:@"New Title" forState:UIControlStateNormal];

Vivek Sharma,

iPhone App Developer

For any iPhone prgramming help come to my blog...

http://viksiphoneblog.blogspot.com/

Vivek Sharma