사용자 정의 TableView 셀인 간단한 인터페이스 작성기 파일이 있습니다. 사용자 정의의 tableview 셀은 두 개의 콘센트 ... 나는이 오류가 몇 가지 이상한 이유로사용자 정의 TableView 셀의 UIWebView
- 웹보기
- 텍스트 레이블
...
2012-07-12 16:28:23.206 VideoPush[3761:707] -[UITableViewCell webView]: unrecognized selector sent to instance 0x168cc0
2012-07-12 16:28:23.211 VideoPush[3761:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITableViewCell webView]: unrecognized selector sent to instance 0x168cc0'
*** First throw call stack:
(0x355e188f 0x37988259 0x355e4a9b 0x355e3915 0x3553e650 0x87279 0x33075efb 0x33074fd9 0x33074763 0x33018f37 0x355401fb 0x32410aa5 0x324106bd 0x32414843 0x3241457f 0x3243c911 0x3243c8e3 0x3305a10f 0x33047b33 0x33015ac3 0x33015567 0x33014f3b 0x371d422b 0x355b5523 0x355b54c5 0x355b4313 0x355374a5 0x3553736d 0x3304686b 0x33043cd5 0x86e5b 0x86e00)
terminate called throwing an exception(lldb)
내 XIB있다
그리고 여기가
#import <UIKit/UIKit.h>
@interface VPCustomCell : UITableViewCell
@property (strong, nonatomic) IBOutlet UIWebView *webView;
@property (strong, nonatomic) IBOutlet UILabel *titleLabel;
@end
마지막
실제 테이블보기를 포함 내보기 컨트롤러 ...- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
NSString *htmlString = @"<html><head> <meta name = \"viewport\" content = \"initial-scale = 1.0, user-scalable = no, width = 120\"/></head> <body style=\"background:#FFF;margin-top:0px;margin-left:0px\"> <div><object width=\"120\" height=\"80\"> <param name=\"movie\" value=\"http://www.youtube.com/v/1Xqn5IHbusA&f=gdata_videos&c=ytapi-my-clientID&d=nGF83uyVrg8eD4rfEkk22mDOl3qUImVMV6ramM\"></param> <param name=\"wmode\" value=\"transparent\"></param> <embed src=\"http://www.youtube.com/v/1Xqn5IHbusA&f=gdata_videos&c=ytapi-my-clientID&d=nGF83uyVrg8eD4rfEkk22mDOl3qUImVMV6ramM\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"120\" height=\"80\"></embed> </object></div></body></html>";
// Configure the cell...
[cell.webView loadHTMLString:htmlString baseURL:[NSURL URLWithString:@"http://www.youtube.com"]];
cell.titleLabel.text = @"Hello";
return cell;
}
주입니다 CustomCell.h 위 XIB의 컨트롤러 ...입니다 : 인터페이스 파일에서 이것을 선언하고 사용자 정의 셀을 가져옵니다.
VPCustomCell *cell;
이해하는데 어려움이 무엇이 문제입니까?
어디에도 '셀'에 대한 선언이 없습니다. xibs 또는 스토리 보드를 사용하고 있습니까? –
사용자 정의 셀에 대한 tableview 및 xib에 대한 스토리 보드 –
스토리 보드 내에서 사용자 정의 셀을 구현할 수 있습니다.이 방법은 이동하기가 훨씬 쉬우 며 'dequeueReusableCellWithIdentifier :'를 사용할 수도 있습니다. 당신이해야 할 일은 프로토 타입 컨텐츠를 사용하도록 테이블 뷰를 설정 한 다음 거기에 표시되는 셀을 사용자 정의 셀 클래스로 변경할 수 있고 거기에 웹 뷰를 삽입 할 수 있습니다. –