Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to display an image using UIView in XCode?
    primarykey
    data
    text
    <p>Absolutely beginner question. I am trying to make an app which will switch an array of images by swiping the screen sideways. So, as vanilla case of that I was trying to display an image first and then think about how to switch between images using an action. I am using XCode 4.2. </p> <p>So, here's what I have so far. I have added a UIImageView to my storyboard, then Ctrl+dragged into the ".h" file to create an Outlet and it looks something like this:</p> <h3>SwitchViewController.h</h3> <pre><code>#import &lt;UIKit/UIKit.h&gt; @interface SwitchViewController : UIViewController @property (weak, nonatomic) IBOutlet UIImageView *imageView; @end </code></pre> <p>And then in the ".m" file, I am trying to set an image to the UIImageView in the DidLoad method.</p> <h3>SwitchViewController.m</h3> <pre><code>#import "SwitchViewController.h" @implementation SwitchViewController @synthesize imageView; - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use. } #pragma mark - View lifecycle - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. UIImage *plate1 = [UIImage imageNamed:@"plates1.tif"]; [imageView setImage:plate1]; } - (void)viewDidUnload { [self setImageView:nil]; [super viewDidUnload]; // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { if ((interfaceOrientation == UIInterfaceOrientationLandscapeRight) || (interfaceOrientation == UIInterfaceOrientationLandscapeLeft)) return YES; return NO; } @end </code></pre> <p>Now, if I try to run this, there are no compilation errors. <br/>But the program halts saying, <em>Thread 1:Program received signal "SIGABRT"</em></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload