동일한 스토리 보드에 UITableView
및 UIView
사용자 정의 응용 프로그램이 있습니다. UIView
은 선택에 따라 사용자 지정 차트를로드하고 HighChart를 사용하여 UIWebView
을로드합니다 (데이터와 html은 모두 로컬로 저장되며 네트워크를 통해 가져 오지 않음).UITableViewCell 선택시 UIView 업데이트
UITableViewCell
을 선택하면보기가 표시되지 않습니다. 그것은 서브 뷰를 불러오고 (콘솔에 출력하는 것은 NSLog
임) 모든 데이터는 정확하지만 디스플레이 자체는 결코 새로 고쳐지지 않습니다. 나는 20 가지 이상의 장소에서 [myCustomView setNeedsDisplay]
을 고집하려고 시도했지만, 다른 것처럼 느껴지기 시작했습니다.
웹보기를로드 중이므로 문제가있을 수 있습니까? 내 에 대한 비동기 호출이 수행되기 전에 본질적으로 내 UIView
을 다시 그리니? 이것을 테스트하는 가장 쉬운 방법은 무엇입니까? 일부 코드를 업데이트
(요청에 따라 일부를 건너 뛰는, 나는 더 채우 것이다) :
는@implemention MainViewController
-(void)viewDidLoad {
***normal viewDidLoad stuff***
_myCustomView = [[MyCustomViewClass alloc] initWithFrame: CGRectMake(0,_tableview.frame.origin.y + _tableview.frame.size.height,_tableview.frame.size.width, 176)];
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
MyCustomJsonDataObject *dataObject = [self.jsonDataArray objectAtIndex:[indexPath row]];
[_myCustomView redrawWithDataObject:dataObject];
}
@end
@implementation myCustomViewClass {
UIScrollView *scrollView
}
-(void)redrawWithDataObject:(MyCustomJsonDataObject *)dataObj {
scrollView = [[UIScrollView alloc] initWithFrame:etc];
// THere are 3 screens initialized: 1 chart data with a UIWebView, and two custom UIViews.
scrollView.contentSize = CGSizeMake(scrollView.size.width * 3, 176)
** initialize web view from custom class **
[scrollView addSubview:webView];
** initialize custom view from custom class **
[scrollView addSubview:UIView1];
** initialize custom view from custom class **
[scrollView addSubview:UIView2];
** set some scrollView properties (scrollable, paging, etc) **
[self addSubview:scrollView];
[self setNeedsDisplay];
}
사용자 정의 UIWebView
클래스는 JSON
객체로부터 데이터를 받아, 로컬 HTML 파일에 자바 스크립트 자리 표시 자 변수를 대체합니다 그런 다음 새 파일을 다시 WebView로 보냅니다. 다른 두 가지보기는 사용자 지정 데이터 개체의 데이터를 채우는 단순한 레이블 집합입니다.
_myCustomView 이미 스토리 보드에 정의되고, 그래서 그 자체를 초기화되었습니다
코드 무엇을 시도 했습니까? – CoolMonster
코드는 어디에 있습니까? 코드를 보면서이 질문에 대답하는 것이 원격으로도 어떻게 가능합니까? 수 천 가지가 될 수 있습니다. –
관련 코드를 제안하려고했지만 몇 가지 문제가 있습니다. 1) 엔터프라이즈 응용 프로그램이므로 코드가 독점적 인 것으로 간주됩니다. 2) 응용 프로그램이 매우 복잡하며 관련 코드 청크를 분리하는 것이 어려울 수 있습니다. 난 나머지 응용 프로그램과 격리 된 코드를 가짜 복제하려고합니다. – xianritchie