新しいxcodeのページベースのアプリケーションを、単一のビューアプリケーションを使用するだけで適応させるブックアプリケーションを作成しようとするのは初めてです。目的C:別のページに画像を追加する
このコードが見つかりました。この作品のHTMLコンテンツをUIImageViewに置き換えようとしていますが、失敗しました。
- (void) createContentPages
{
NSMutableArray *pageStrings = [[NSMutableArray alloc] init];
for (int i = 1; i < 11; i++)
{
NSString *contentString = [[NSString alloc]
initWithFormat:@"<html><head></head><body><h1>Chapter %d</h1><p>This is the page %d of content displayed using UIPageViewController in iOS 5.</p></body></html>", i, i];
[pageStrings addObject:contentString];
}
pageContent = [[NSArray alloc] initWithArray:pageStrings];
}
私はページごとに異なる画像を表示しようとしています。
ここは私がしたものです。
- (void) createContentPages
{
NSMutableArray *pageStrings = [[NSMutableArray alloc] init];
for (int i = 1; i < 11; i++)
{
NSArray *photos = [[NSArray arrayWithObjects:
[UIImage imageNamed:@"p1.png"],
[UIImage imageNamed:@"p2.png"],
[UIImage imageNamed:@"p3.png"],
[UIImage imageNamed:@"p4.png"],
nil];
[pageStrings addObject:photos];
}
pageContent = [[NSArray alloc] initWithArray:pageStrings];
}
(私は私はちょうどそれを試してみましたので、間違っている知っている)、それは各ページでのUIWebViewを持っています。私はUIImageViewと置き換えて実行することは可能ですか?サブクラス
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[webView loadHTMLString:dataObject
baseURL:[NSURL URLWithString:@""]];
}
ARCを使用していますか? – CarlJ