Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID
Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.

UIImageView & Error 101

RobTucker11RobTucker11 Posts: 12Registered Users
I'm trying to build a simple animation. When running in the simulator it works fine. When trying to run on the device, it crashes. From the research i've done it appears as though the issue is with how i'm loading my images into the array for the image view.
Here is the code from my ViewController.m File. There are some other parts, but it crashes before it gets to them.

@synthesize mainImage, buttonClicked, radarImagesArray, analyzingImagesArray, arr1;
- (void)viewDidLoad {
int counter = 1;
mainStatus = 0;
[buttonClicked setImage: [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@\"analyze\" ofType:@\"png\"]] forState:UIControlStateNormal];
arr1 = [[NSMutableArray alloc] init];
[arr1 addObject:@\"image1\"];
[arr1 addObject:@\"image2\"];

NSString *temp;
UIImage *tempImage;
temp = [[NSString alloc] init];
tempImage = [[UIImage alloc] init];
radarImagesArray = [[NSMutableArray alloc] init];
analyzingImagesArray = [[NSMutableArray alloc] init];
for(int x = 1; x <= 75; x++){

NSString *holder = [[NSString alloc] init];
if(counter < 10){
holder = [NSString stringWithFormat: @\"00\"];
}

if(counter >= 10 && counter < 100){
holder = [NSString stringWithFormat: @\"0\"];
}

temp = [NSString stringWithFormat:@\"iStock_000003493496Small We %@%i\", holder, x];
tempImage = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:temp ofType:@\"jpg\"]];
if(tempImage){
[radarImagesArray addObject: tempImage];
//[tempImage release];
//[tempImage dealloc];
}
//if(temp)[temp release];

counter++;

}
counter = 1;
for(int x = 1; x <= 20; x++){

NSString *holder = [[NSString alloc] init];
if(counter < 10){
holder = [NSString stringWithFormat: @\"00\"];
}

if(counter >= 10 && counter < 100){
holder = [NSString stringWithFormat: @\"0\"];

}

temp = [NSString stringWithFormat:@\"iStock_000004494873Small We %@%i\", holder, x];
tempImage = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:temp ofType:@\"jpg\"]];
if(tempImage){
[analyzingImagesArray addObject: tempImage];
//[tempImage release];
}
//if(temp)[temp release];
counter++;
}

[mainImage setAnimationImages: radarImagesArray];
[mainImage startAnimating];
[super viewDidLoad];
}

Here is the code from my .h


#import <UIKit/UIKit.h>

@interface MandarViewController : UIViewController {
IBOutlet UIImageView *mainImage;
IBOutlet UIButton *buttonClicked;
NSMutableArray *radarImagesArray;
NSMutableArray *analyzingImagesArray;
NSMutableArray *arr1;
int mainStatus;
}
@property(nonatomic, retain) UIImageView *mainImage;
@property(nonatomic, retain) NSMutableArray *radarImagesArray;
@property(nonatomic, retain) NSMutableArray *analyzingImagesArray;
@property(nonatomic, retain) NSMutableArray *arr1;
@property(nonatomic, retain) UIButton *buttonClicked;
-(IBAction)buttonClicked:(id)sender;
-(void)stopBuildingAnalyzingImagesArray;
@end


I'm somewhat new to the iPhone SDK and cocoa in general and I'm assuming that the issue is something simple that I'm missing. Please HELP!!
Post edited by RobTucker11 on

Replies

Sign In or Register to comment.