Question

In the iphone storyboard, i create a view controller, then i add a generic view to that controller, then add a image view to the generic view. Then i implement the generic view controller code. However, it doesn't show anything in the image view rectangle.

If i didn't add a generic view first, just add a image view to the generic controller instead, it will show the image i want. But in this way, i can't embed in a scroll view into that image view cause the "Embed In" option in Xcode is gray. If i add a generic view then image view, the "Embed In" can be selected to let me add a scroll view into the image view.

I got confused why it has this problem and couldn't figure out. Thanks.

Was it helpful?

Solution

Actually since no one helped me, then i just figured out by myself.

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.imageView = [self.imageView initWithImage:self.image];
    self.scrollView.delegate = self;
    self.imageView.image = self.image;
}

The problem is this statement:self.imageView = [self.imageView initWithImage:self.image];, cause it disables the user interactions for the image view by default.(From the documentation)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top