-2

我有一个 TableViewCell,其中有一个按钮 Zoom Button。当我单击缩放按钮时,视图将导航到 PlayerViewController。

https://www.dropbox.com/s/ikmj4vdfc407ldy/customcell.png

这是我的播放按钮代码。

-(IBAction)downloadAction:(id)sender 
{
            BookPlayerViewController *bookPlayerViewController=[BookPlayerViewController alloc];
            [self.navigationController pushViewController:bookPlayerViewController animated:YES];
}

我怎么解决这个问题?。我正在使用 Nib 而不是情节提要来实现该项目。

4

4 回答 4

1

您没有初始化笔尖名称。您需要使用 NibName 初始化 BookPlayerViewController 才能显示它,

使用IB

BookPlayerViewController *vcBookPlayerViewController = [[BookPlayerViewController alloc] 
initWithNibName:@"BookPlayerViewController" bundle:nil]; 

使用情节提要

BookPlayerViewController *vcBookPlayerViewController = [storyboard
instantiateViewControllerWithIdentifier:@"BookPlayerViewController"];
于 2013-10-02T10:52:46.610 回答
1
I  created an outlet property in the tableviewcell class
@property (retain, nonatomic) IBOutlet UIButton *zoomButton;

然后我在 tableviewCellForRowAtIndex 方法的超类中添加目标

[cell.zoomButton addTarget:self action:@selector(navigateAction:) forControlEvents:UIControlEventTouchUpInside];

然后我采用 NavigateAction 的 IBAction,我编写了从一个 ViewController 导航到另一个 ViewController 所需的那些操作。

-(IBAction)navigateAction:(id)sender

{

*UIButton *btn = (UIButton *)sender;
int indexrow = btn.tag;
NSLog(@"Selected row is: %d",indexrow);

currentBook = [[bookListParser bookListArray] objectAtIndex:indexrow];

KitapDetayViewController *kitapDetayViewController;
if(IS_IPHONE_5)
{
    kitapDetayViewController = [[KitapDetayViewController alloc] initWithNibName:@"KitapDetayViewController" bundle:Nil];
}

else
{
    kitapDetayViewController = [[KitapDetayViewController alloc] initWithNibName:@"KitapDetayViewController_iPhone4" bundle:Nil];
}
kitapDetayViewController.bookId=currentBook.bookId;
kitapDetayViewController.detailImageUrl = currentBook.detailImageUrl;
kitapDetayViewController.bookAuthor = currentBook.bookAuthor;
kitapDetayViewController.bookName = currentBook.bookName;
kitapDetayViewController.bookDescription = currentBook.bookDescription;
kitapDetayViewController.bookNarrator=currentBook.bookNarrator;
kitapDetayViewController.bookOrderHistory=currentBook.bookOrderDate;
int byte=[currentBook.bookSizeAtByte intValue];
int mb=byte/(1024*1024);
NSString *mbString = [NSString stringWithFormat:@"%d", mb];
kitapDetayViewController.bookSize=mbString;
kitapDetayViewController.bookOrderPrice=currentBook.priceAsText;
int second=[currentBook.bookDuration intValue];
int minute=(second/60)%60;
int hour=(second/3600)%60;
int sec = second % 60;

NSString *formattedTime = [NSString stringWithFormat:@"%d:%d:%d", hour, minute, sec];
kitapDetayViewController.bookDuration=formattedTime;
kitapDetayViewController.chapterNameListArray=self.chapterNameListArray;
// [[bookListParser bookListArray ]release];
[self.navigationController pushViewController:kitapDetayViewController animated:YES];*

}

这样我就解决了这个问题。

于 2014-09-07T12:05:38.323 回答
0

如果您正在加载 nextview 的笔尖,请尝试这种方式

BookPlayerViewController *vcBookPlayerViewController = [[BookPlayerViewController alloc] initWithNibName:@"BookPlayerViewController" bundle:nil]; 
[self.navigationController pushViewController:vcBookPlayerViewController animated:YES];
于 2013-10-02T10:40:35.733 回答
0

你错过了笔尖检查这段代码..

-(IBAction)downloadAction:(id)sender 
{
            BookPlayerViewController *bookPlayerViewController=[BookPlayerViewController alloc]initWithNibName:@"BookPlayerViewController" bundle:nil];;
            [self.navigationController pushViewController:bookPlayerViewController animated:YES];
}
于 2013-10-02T10:53:05.930 回答