アップルのImage Zoomingのサンプルをベースにして、画像のズーム、スクロール、アプリのサンドボックスに保存されます。アップルのImage Zooming Appのコードをベースにして、単純なInterface Builderの知識が失われています
私はScrollView負荷、それは空白だとき、それは一種のことを除いて、今働いています。コードは次のようになります。
@interface PhotoViewController : UIViewController <UIScrollViewDelegate> {
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;
}
XIBが写真を見るController->スクロール表示 - >ビューの構造を有しています。私はこれが問題の場所であると感じています。例と同じようにすべてのアウトレットを接続しようとしましたが、アウトレットの参照では、この例にはImageZoomingAppDelegateに接続されたviewControllerがあります。私のPhotoViewControllerはサブビューであるので、そのようなviewControllerをフックする場所はありません。ここで
は私がPhotoViewControllerを持ち出す方法は次のとおりです。
(IBAction) photoButtonPressed: (id) sender {
viewController = [[PhotoViewController alloc] init];
[self.navigationController pushViewController:viewController animated:YES];
}
私は、私はそれがすべて右フックアップ有することにちょうど「この近くに」でなければならないけど、私はへのXIBの関係を理解していませんそれをデバッグする方法を理解するのに十分なコードです。正しい質問をするのに十分なことが分かっているかどうかはわかりません。