如题,在创建ContentView的时候,例子如下
NSString *viewClassName = NSStringFromClass([self class]); viewClassName = [viewClassName stringByReplacingOccurrencesOfString:@"Controller" withString:@""]; Class viewClass = NSClassFromString(viewClassName); if ([viewClass isSubclassOfClass:[UIView class]]) { id currentView = [[viewClass alloc] initWithFrame:self.view.bounds]; self.baseView = currentView; //千万不要用self.view = currentview. [self.view addSubview:currentView]; }
原文:http://www.cnblogs.com/yqlog/p/4916707.html