if i was hidden the image view.. run time error was occured or
imgView.hidden=YES;
imgView.hidden=NO;
this two lines are got a runtime error.. how to handle this..... or
imgView.image= any one image
imgView.image=nil
this two lines also got a run time error is "exec-bad access" or "debugging is termnated"
how to handle this, please help me
Have you create outlet for imageview or not?
If it's not outlet then you have to initialize the imageview
Related
My main app is using Storyboard's for laying all my views out. Next... I've also got a xib file that holds a few buttons that I'd like to apply in a fancy sort of overlay. This is also working great using a technique I found here: http://www.stackoverflow.com/a/12574190/949538
The Files Owner is hooked up to the main view controller. And from a button on my main view, I can pop open this xib nicely.
The problem comes from trying to attach an IBAction to anything I put on this xib. All of i have no warnings, no build errors, everything looks fine. Until I pop open the xib/view, and hit one of my buttons, then I get this:
2012-11-19 15:44:48.685 Frolfer[89367:c07] -[UIViewController closeStartPanel:]: unrecognized selector sent to instance 0x8352e90
2012-11-19 15:44:48.686 Frolfer[89367:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController closeStartPanel:]: unrecognized selector sent to instance 0x8352e90'
MainViewController.m
-(IBAction)closeStartPanel:(id)sender {
NSLog(#"close start panel");
}
It's got to be something just so basic that I'm forgetting / missing.
Any thoughts?
P.S.
There literally is not much code written yet, but if you'd like to see anything more just let me know. I'm not sure exactly what it is that you'd like to see...
Thanks in advance!!
- drew
Is there closeStartPanel: selector defined for that UIButton ? Can you post code for that? the exception clearly states that it is not able to find closeStartPanel selector for that UIButton in UIViewController...
I figured it out!
Not sure why I didn't try this before, but it works great now.
Usually when I'm in the Storyboard, I'd drag 'Touch Up Inside' handle over on top of my button to see the available IBActions's that I had created in my header. With the xib file, this wasn't happening at all. So as noted previously, I changed class of the Files Owner on my xib to my MainViewController.
After that, all my defined IBActions were appearing as I had expected them to when dragging 'Touch Up Inside' over to the button on screen in IB.
That's where the crashes started happening though.
This morning, I removed all associations to MainViewController on my xib file, and by accident, had drug the 'Touch Up Inside' handle over to First Responder. I guess I don't play with First Responder much... but to my surprise, all my IBActions were listed in there. For some reason, I thought I wouldn't see them.
After a clean and compile... boom, they worked! I guess the only downside (if you want to call it that), is that in the code view, it doesn't give an indication that your defined IBAction is hooked up to a button in the IB with the filled in gray dot like my other buttons that are directly on the storyboard do.
Oh well, seems to be working the way I had hoped (for now), so I'm going to just roll with it.
:-)
Have a great Thanksgiving weekend.
- Drew
I'm starting to program using Xcode/iOS
I've been reading some books and tutorial...
For my first application, I tried to do a "Hello World"
I did the program following every single step in the right way, but when I run the application, the program crash...
I read some posts to find the solution, but even when I check or do the steps that the posts suggest, I still have the same error. I tried to do another project, but the result is always the same.
This the capture of my screen
Try to set your "View reference outlet to files owner" by dragging the link
from "Views" to "File's Owner" in your nib. I think that's why you are getting
the crash:
Change the Class of File Owner to your ViewController,
Then set the View Outlet Again..!!
If it doesn't work, delete the view and drag a new one from Library. Set File Owner and View outlet again.
I got to change the first view of my iphone first project, i tried to change it in the app delegate but something is not working. What I got to do exactly? Thank you guys
ok what error you are getting when you run the application.more over try to create the instance of viewcontroller1 in app delegate and add it to window,it works.`
I just added a UIDatePicker to my iPad app using IB, linked it to its outlet in the code, saved it in IB, added the UIPickerViewDelegate to my UIViewController in the code, as well as added the UIDatePicker outlet in code. When I build and run, the app launches, but will crash intermittently when I attempt to open the popover view that contains the datepicker. I say intermittently because the popover view will occasionally open successfully, but never more than once (it always crashes the second time you open the popover, if it doesn't crash the first time). Also, in the console, I get the following messsage
objc[594]: FREED(id): message lastClickRow sent to freed object=0x6015a70
Why is this happening and how can I fix it?
What does that console message indicate?
It may be worth mentioning that the popover view also contains a table view along with the datepicker control.
Thanks so much in advance for your help!
I too had a tough time getting through this problem but at last got it resolved.
Instead of adding UIDatePicker in interface builder, add it dynamically or programatically. It surely worked for me and hope that it works for you too.
UIDatePicker *_datePicker=[[UIDatePicker alloc] initWithFrame:frame];
[self.view addSubview:_datePicker];
This is almost certainly a reference count issue. It seems odd that your view controller (which I'm assuming is the delegate of your UIDatePicker, since that's where you implemented the protocol) would be released during normal operations, but that's the first thing you should look at - that the delegate is set and remains a valid object at the time you display the popup view.
One funny thing you could have done is to release it UIPopOverController reference after passing it the [presentPopover...] message, just like we do at passing a presentModalViewController message to the UIViewController.
I faced this problem too, one thing you can do is something like
self.funnyPopoverController = aPopoverController;
(of course funnyPopoverController is retain type property here).
Otherwise its hard to predict whats happening without staring at the code for some long long time_t hours :)
I'm using the three20 project for my iPhone app. I've narrowed my problem down and I'm now just trying to re-create the 'Web Images in Table' example that comes with the project. I've copied the code exactly as in the project, with the exception that I do not use the TTNavigator (which the example does) but I am adding my TTTableViewController manually to a tabBar.
The problem is as follows; the images in the table should load automatically from the web, like in the example. But they only load after I scroll the table up and down.
In the console it clearly says it is downloading the images, and you see the activity indicator spinning like forever.. And unless I scroll up and down once, the images will never appear.
Anyone? Thanks in advance.
P.S:
If I'm using this code in any random UIView, It also doesn't work (only shows a black square):
TTImageView* imageView = [[[TTImageView alloc] initWithFrame:CGRectMake(30, 30, 100, 100)] autorelease];
imageView.autoresizesToImage = YES;
imageView.URL = #"http://webpimp.nl/logo.png";
[self.view addSubview:imageView];
If I put this code in my AppDelegate (right onto the window), it does work .. strange?
POSSIBLE SOLUTION:
Although I stopped using TTImageView for this purpose, I do think I found out what the problem was; threading (hence accepting the answer of Deniz Mert Edincik). If I started the asynchronous download (because basically that is all the TTImageView is, an asynchronous download) from anywhere BUT the main thread, it would not start. If I started the download on the main thread, it would start immediately..
Sounds like a threading problem to me, are you creating TTImageView in the main runloop?
I find one interesting thing. When I use combination TTTableViewController, TTTableViewDataSource and TTModel I have same problem with loading TTImageView. My problem was, that my implementation of Model methods 'isLoading' and 'isLoaded' don't return proper values after initialization of model. That forces me to call reload on model manualy in 'viewDidAppear' method and that causes image loading problem. So I repair my 'isLoading' and 'isLoaded' methods to both return 'NO' after Model init, and everything is fine.
When an image finishes loading try sending a reloadData message to the table view. This forces the table to recalculate the size of the rows and redraw the table. Just be careful that you don't start downloading the image again in response to this message.
I've written something similar to this where an image view will load its own image from the web.
Im my experience, when the image had loaded successfully but was not shown in its view, it was a case that the cell needed to be told to redraw.
When you scroll the table view, the cells are set to redraw when the come onscreen, which is why they appear when you scroll.
When the image loads, tell the cell that it is sitting in to redraw by sending it the message setNeedsDisplay.
That way, when the image finishes downloading, the cell its sitting in (and only that cell) will redraw itself to show the new image.
It's possible that you might not need to redraw the entire cell and might be able to get away with simply redrawing the image view using the same method call. In my experience, my table cells view hierarchy was flattened, so I had to redraw the whole cell.
I don't have an answer for what you want to do, but I will say that this is considered a feature, and the expected behavior. You use TTImageView in UITableView when you want to do lazy loading of images. TTImageView will only load the images whose frames are visible on the screen. That way, the device uses its network resources to download images that the user has in front of them, rather than a bunch of images that the user isn't even trying to look at.
Consider having a long list that may contain a couple hundred thumbnail images (like a list of friends). I know from experience that if you kick off 100+ image requests on older devices, the memory usage will go through the roof, and your app will likely crash. TTImageView solves this problem.
This is a thread problem. You can load the images by including the line:
[TTURLRequestQueue mainQueue].suspended = NO;
in - (void)didLoadModel:(BOOL)firstTime.