It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
My app has a problem that if I click a button to open a window, close the new window, and click the button again, it crashes and xcode says:
Thread 1:EXC_BAD_ACCESS (code=13, address=0x0)
Your button is attached to a method, that much is certain.
That method is being called on the second push, that's logical too.
So an object pointer that is alive in the first push is being assigned nil after the first push.
My guess, without any code from you to help give any further insight, your window is already created before pushing the button. Later, when you close the window, the pre-existing object is assigned nil. Then you try opening it again, you reference it without checking it being nil.
That's my guess of an answer, without any code to see. Feel free to accept this answer, it's perfectly reasonable, without seeing any code. :)
I fixed it, so if anyone has this problem, just go into your xib, click on your windows, and uncheck release when closed
Related
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have an iPad app, built in XCode4.5, using Storyboards and iOS6. I have a UITableView that I am trying to fill from a CoreData store using MagicalRecord. This is the piece of my code that's giving me problems:
- (id) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
self = [super initWithStyle:<#style#> reuseIdentifier:reuseIdentifier]; // <--
if(self) {
// initialization code
}
return self;
}
I'm getting a build error (on the line with the // <--) saying "expected expression". I have looked in SO, Google and absolutely can not figure this out! (I have the same code running in another app with no problems).
Can someone please tell me how to correct this?
Well I don't know if that was a paste mistake or whatever, buu should write it this way:
self = [super initWithStyle: style reuseIdentifier:reuseIdentifier];
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
Right now my StoryBoard is like this:
X->X->X
I want it to be like this:
X->Y->X->X
Y will be a simple Tableview connected to the navigation controller on one end and to masterviewcontroller on the other end with a basic cell pushing to it. I don't want to change anything in the app besides that.
but when I'm trying to do so I'm getting an error:
ScaryBugs[1768:11303] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITableViewController setBugs:]: unrecognized selector sent to instance 0x71d0940'
I'm guessing it's because I don't completely understand what those 3 lines are doing.
AppDelegate.m:
UINavigationController * navController = (UINavigationController *) self.window.rootViewController;
MasterViewController * masterController = [navController.viewControllers objectAtIndex:0];
masterController.bugs = bugs;
Source of code
That third line is just assigning the bugs property of the masterController to the array that was created in the app delegate with the local variable name, bugs. The first 2 lines are just getting references to the controllers that were created in the storyboard.
By putting another controller in as the root view controller of the navigation controller, you're screwing up the references. After adding it, the MasterController is now not even instantiated until you push to it, so there's no way to set its bugs property. Your new controller just doesn't belong there. It wouldn't really make sense to push from your list of bats, sharks, etc. to a list of bugs -- usually, that push (especially if it's from a table view cell) means you're going to present some information that gives more details about the cell you touched. IF you're trying to expand upon the tutorial, you really need to change the overall structure of the app, and that could require quite a few changes in the code.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have several UITableViews and what I would like to do is to be able to change the properties of those UITableViews from a single class, which is the AppDelegate class.
Does anyone know if it would be possible to do so?
If You are using iOS5 then you can use UIAppearance
//For example this changes the background color of all UITableViews contained in a UIView
[[UITableView appearanceWhenContainedIn:[UIView class], nil] setBackgroundColor:[UIColor greenColor]];
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I know this is an easy one, but I just thought I could spare myself some (more) time searching through the documentation.
Usually, when I have an "Add" and a "Remove" button, along with an NSArrayController, I simply have to click-drag from each button and connect them to the add: and remove: actions of the NSArrayController.
Now, I'm trying to do the very same thing, programmatically with NSArrayController (co) :
[addButton setAction:#selector(add:)];
[addButton setTarget:co];
What am I doing wrong?
The rest of the NSArrayController operations, handling an NSMutableArray of dictionaries, etc works fine.
My psychic debugger* tells me that you're probably doing this in an init method, where neither of the outlets, to the array controller or the button, are connected yet.
Put this into awakeFromNib or a method which you know is called after the xib is loaded.
*psydb, of course.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
what is the function of UIButton in " UIButton *storenumber;
UIButton * is the type of the pointer. storenumber is a variable that points to an instance of the UIButton class.
As Caleb said, it is a pointer type. This is very useful whenever you have a button in your app, especially because you will need it to release the button in the dealloc method. I have also found that it is useful because you it will let you change the image, size, position, ect. of the button. If you don't know how to use these things, look at the examples below.
- (void) dealloc {
[someButton release];
}
This will release the button, thereby allowing giving you more memory to work with. The following examples are used quite often by programmers.
[someButton setHidden:(BOOL)];
[someBuuton setImage:(UIImage*) forState:(UIControlState)];
[someButton setFrame:(CGRect)];
I hope this helps!