Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3694766
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:32:10+00:00 2026-05-19T04:32:10+00:00

I know this question is asked many a times,and i am also implementing the

  • 0

I know this question is asked many a times,and i am also implementing the same funda for chanding the title of the uibutton i guess.

Let me clarify my problem first. I have one uibutton named btnType, on clicking of what one picker pops up and after selecting one value,i am hitting done button to hide the picker and at the same time i am changing the the title of the uibutton with code

[btnType setTitle:btnTitle forState:UIControlEventTouchUpInside];
[btnType setTitleColor:[UIColor redColor] forState:UIControlEventAllEvents];

But with my surpriaze,it is not changed and application crashes with signal EXC_BAD_ACCESS. I am not getting where i am making mistake.I have allocated memory to the btnType at viewdidLoad. Also I am using

-(IBAction)pressAddType
{
    toolBar.hidden = FALSE;
    dateTypePicker.hidden = FALSE;
}

event on pressing the button to open the picker. Also i would like to mention that i have made connection with IB with event TouchUpInside for pressAddType.

Any guesses? I will be grateful if you could help me.
Thanks.

UPDATE:

@interface AddSettingPage : UIViewController<UITextFieldDelegate>
{
    IBOutlet UIButton *btnType;
    NSString *btnTitle;
}
@property (nonatomic, retain) IBOutlet UIButton *btnType;
-(IBAction)pressAddType;//:(id)sender;

Also

@synthesize btnType,btnTitle;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T04:32:10+00:00Added an answer on May 19, 2026 at 4:32 am

    try

    [yourButton setTitle:@"your title" forState:UIControlStateNormal];
    [yourButton setTitle:@"your title" forState:UIControlStateSelected];
    [yourButton setTitle:@"your title" forState:UIControlStateHighlighted];
    

    when the picker is dismissed, the button (which was the control that hold focus) will be in the selected state (or the highlighted .. check it out).

    and stop using UIControlEventTouchUpInside in the forState: parameter. it is not a state, it is an event. you are passing an event identifier instead of a state identifier

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i know that this is a famous question and have been asked many times.
I know this question has been asked many times, but my problem is a
I know this question has been asked many times, and I've searched stackoverflow and
I know this is a question that has been asked many times before, but
I know this question is asked many times but I just want to clear
Ok I know this question has been asked many many many times before, but
I know that this question has been asked many times before in different guises
I know this question was asked many times, but still my problem is not
I know this question has been asked many times and I've researched it myself
I know this question has been asked many times, but I am having trouble

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.