Note that there are some explanatory texts on larger screens.

plurals
  1. POTrying to base some code off of Apple's Image Zooming App example, missing some simple Interface Builder knowledge
    primarykey
    data
    text
    <p>I'm trying to base part of my app off of Apple's Image Zooming example, to get zooming, scrolling, and orientation of images that are saved to the app's sandbox.</p> <p><a href="http://developer.apple.com/library/ios/#documentation/WindowsViews/Conceptual/UIScrollView_pg/Introduction/Introduction.html" rel="nofollow">http://developer.apple.com/library/ios/#documentation/WindowsViews/Conceptual/UIScrollView_pg/Introduction/Introduction.html</a></p> <p>I have it sort of working now, except that when the ScrollView loads, it's blank. The code looks something like this:</p> <pre><code>@interface PhotoViewController : UIViewController &lt;UIScrollViewDelegate&gt; { UIScrollView *imageScrollView; UIImageView *imageView; } @property (nonatomic, retain) IBOutlet UIScrollView *imageScrollView; @property (nonatomic, retain) UIImageView *imageView; @end @implementation PhotoViewController @synthesize imageView, imageScrollView; - (void)viewDidLoad { [super viewDidLoad]; imageScrollView.bouncesZoom = YES; imageScrollView.delegate = self; imageScrollView.clipsToBounds = YES; imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image1.jpg"]]; imageView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; imageView.contentMode = UIViewContentModeScaleAspectFit; imageView.backgroundColor = [UIColor blackColor]; imageView.userInteractionEnabled = YES; [imageScrollView addSubview:imageView]; imageScrollView.contentSize = [imageView frame].size; } </code></pre> <p>The xib has a Photo View Controller->Scroll View->View structure. I have a feeling this is where the problem is. I tried to hook up all the outlets identically to the example, but under Referencing Outlets the example has a viewController hooked up to the ImageZoomingAppDelegate. Since my PhotoViewController is a subview, there's not a place to hook up the viewController like that.</p> <p>Here's how I bring up the PhotoViewController:</p> <pre><code>(IBAction) photoButtonPressed: (id) sender { viewController = [[PhotoViewController alloc] init]; [self.navigationController pushViewController:viewController animated:YES]; } </code></pre> <p>I know I must be just "this close" to having it all hooked up right, but I don't understand the relationship of the xib to the code well enough to know how to debug it. I'm not even sure if I know enough to ask the right questions.</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.
    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