I have two buttons in my view. When I sent the tag value of one of them in Interface Builder they stop working. I get EXC_BAD_ACCESS error.
Have you linked the button in IB to an actual field? If not, then when you access the field it won't actually refer to the button.
Set the button tag in code programmatically. then in the method which calls the button if(button.tag== [sender tag]){}
Before posting please make sure that you describe your problem clearly.
Make sure all the wiring's are perfect,and look at your your console.
There will be some hints about what is exactly going wrong.
Related
Hi I regulary created using IB one UISegmentedControl that I called showAllSwitch.
If I try to do [showAllSwitch setHidden:YES]; nothing happens!
Why? How can I do to hide it?
Where are you calling setHidden? if it is being called before it is added to the view, then there could be problems. Try calling it in viewDidAppear and see it that works. If it doesn't either the segmentedControl is not connected correctly in IB, or there is a rather big problem that we are missing.
Hiding an object is relatively straight forward. So if there is a problem then its something simple. You need to just go through some basic diagnostic steps:
Verify that your segmented control is actually connected to the correct outlet in IB. Really. Go look. Even if you are sure. Go look again.
Verify that the line where you are hiding it is being called. Add an NSLog just after and see if it shows up when it should.
Make sure that the hide command is not getting sent too soon. If its being sent in ViewDidLoad try setting it up in ViewDidAppear.
I wan't to creata a "CatchNames" class which I can import into a view Controller that shows a text which asks for text input. I would like to be able to add an instance of CatchNames to my view, have it ask the user for three names in a row and return them in an array.
[self.view addSubview:[catchNames view]];
NSArray *myNamesArray = [catchNames namesArray];
The best way would be to have the application freeze kind of the way it does when you are prompted to enter a password in iOS and continue when the user entered 3 names so I can immediately catch the array in the next line.
While this might not be the best description I still hope you understand my problem.
How can I approach this?
Thank you in advance
I guess you appear to be looking to implement a simple form which gets the user input, retrieves and stores it in an array? Hopefully I haven't misunderstood the question, but this seems to be a simple task you can accomplish with one or more UITextField's and a UIButton as a 'Add' or 'Done' call to action.
Are you looking for some general UI coding level help regarding implementing such a view? If so, I would encourage taking a look at the XCode documentations of UITextField (for capturing text), UIButton (for handling actions) and UIView (for view hierarchy and animation implementation).
Some quick notes;
Looks like 3 names are compulsory, so, you may verify whether a UITextField is empty at the button's click action.
Have the array declared in the view controller, not the view
The 'freezing' you require should take care of itself as long as the view offers no other way out for the user other than clicking the button.
Do excuse me if I am oversimplifying the problem. Let me know if you need me to drill down into anything further.
Cheers!
I have a UISegmentedController to allow a user to choose which order they want slides in my app to show up. Im wondering if anyone knows of a method to set it other than value did change. I have other methods that keep getting triggered in viewDidLoad while its being set to their previously selected index. I don't want the other methods triggered until a user changes it. Any suggestions?
Thanks in advance
The simplest way would be adding boolean to your class, e.g. canTrigger. And you can set it to YES, once user changes.
How would I go about updating an object declared in the RootViewController from my MainViewController?
I'm attempting to hide my info button when my iAd is tapped, I have all the relevant pieces of code for the iAd in place, but can't figure out how to code the action. I saw an example of a similar situation online that was like this:
((MainViewController *)parentViewController).infoButton.hidden = #"";
I haven't been able to get that to work though, I just need this one value modifiable from the MVC, can anyone give me a simple suggestion?
P.S. I'm a total n00b and a snippet of code would help a great deal, I'm kind of learning as I go, thanks!
I figured this out through use of the NSNotificationCenter
I've been trying to put a UIWebView into my app, which is tableview based.
When the user selects a row, I want the new xib to load, but this one with a UIWebView on it.
From all of the tutorials I've seen, you can only put a UIWebView on the MainView.xib.
Can someone please tell me how to put a FUNCTIONING UIWebView somewhere other than the main view?
Thanks in advance!!
You can put a UIWebView in any XIB you want. Why do you believe that it has to be in MainView.xib? Tutorials generally put everything in MainView.xib because they're keeping things simple. What problem are you having when you put it elsewhere?
Can you give a link to the tutorial that indicates that you have to put this in MainView? Can you describe what "doesn't work" actually means? Does it fail to display, fail to make callbacks, fail to load pages, render incorrect?