iPhoneとiPadの両方で使用するアプリを開発しています。iPad:サンプルをiOS5にポップアップ
今日私は、アクションシートのPickerViewの代わりにPopover for iPadを使用する必要があることを発見しました。
サンプルアプリケーションをiOS5で使用しようとしていますが、エラーが発生しています。
***キャッチされない例外により 'NSInternalInconsistencyException'、理由にアプリを終了:
' - [のUITableViewController loadViewメソッド] "2-ビュー-5" のペン先をロードしますがのUITableViewを取得できませんでした。'
***まずスローコールスタック:
あなたは正確に私はそれを修正するために何をする必要があるか知っていますか? そして、iOS5のポップオーバーの例をお勧めしますか?
UYLMasterViewController.m
#import "UYLMasterViewController.h"
#import "UYLDetailViewController.h"
@implementation UYLMasterViewController
@synthesize detailViewController = _detailViewController;
#pragma mark -
#pragma mark === View Management ===
#pragma mark -
- (void)viewDidUnload
{
[super viewDidUnload];
self.detailViewController = nil;
}
- (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
#pragma mark -
#pragma mark === Table View Delegates ===
#pragma mark -
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 20;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
NSUInteger row = [indexPath row];
cell.textLabel.text = [NSString stringWithFormat:@"Item %u", row+1];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSUInteger item = [indexPath row] +1;
NSNumber *detailItem = [NSNumber numberWithInteger:item];
if (self.detailViewController)
{
self.detailViewController.detailItem = detailItem;
}
}
@end
こんにちは、iOS5のサンプルを見つけられず、ios4のサンプルを使用していました。だから私はサンプルをダウンロードするとき、私はios5に適したコードを変換する必要があります。私はIBOutletを作成し、ページ上のtableViewに接続しました。 – user973067
Uhmは、あなたがUITableViewControllerに接続するコントローラですか?存在する場合は既にtableViewというプロパティが存在するはずです。新しいプロパティを作成するのではなく、そのプロパティにUITableViewを接続する必要があります。 – Leonardo
どのテーブルビューが必要かわかりません。私は使用していたサンプルコードを編集しました(Appleのものではなく、ストーリーボードを使用しています)。 ViewControllerでテーブルビューをどのように接続するかわかりません。 – user973067