UIExpandableTableView - https://github.com/OliverLetterer/UIExpandableTableView#readme을 사용하고 싶습니다.initWithFrame으로 작성된 클래스 - 스토리 보드에서 인스턴스화하려고합니다.
나는 단지 초기화가 initWithFrame
입니다 때문에 문제로 실행했습니다
#pragma mark - Initialization
- (id)initWithFrame:(CGRect)frame style:(UITableViewStyle)style {
if ((self = [super initWithFrame:frame style:style])) {
self.maximumRowCountToStillUseAnimationWhileExpanding = NSIntegerMax;
self.expandableSectionsDictionary = [NSMutableDictionary dictionary];
self.showingSectionsDictionary = [NSMutableDictionary dictionary];
self.downloadingSectionsDictionary = [NSMutableDictionary dictionary];
self.animatingSectionsDictionary = [NSMutableDictionary dictionary];
}
return self;
}
나는 스토리 보드에서있는 tableView를 초기화하려고했는데이 initWithFrame
이 결코 없기 때문에 제가 보는 오류가 있습니다 실현 호출되고 NSMutableDictionaries
은 초기화되지 않습니다. 어떻게 해결할 수 있을까요?
간단히 해결할 수없는 경우 프로그래밍 방식으로 인스턴스화하고 initWithFrame
과 함께 할 수 있지만 Storyboard를 사용하려는 외에 솔루션이 무엇인지 궁금합니다. 여기
편집 이러한 속성과 인스턴스 변수가 UIExpandableTableView에 선언하는 방법이다. 이것은 .H 파일에 있습니다
@interface UIExpandableTableView : UITableView <UITableViewDelegate, UITableViewDataSource, NSCoding> {
@private ID __UIExpandableTableView_weak _myDelegate; id __UIExpandableTableView_weak _myDataSource;
NSMutableDictionary *_expandableSectionsDictionary; // will store BOOLs for each section that is expandable
NSMutableDictionary *_showingSectionsDictionary; // will store BOOLs for the sections state (nil: not expanded, 1: expanded)
NSMutableDictionary *_downloadingSectionsDictionary; // will store BOOLs for the sections state (nil: not downloading, YES: downloading)
NSMutableDictionary *_animatingSectionsDictionary;
NSInteger _maximumRowCountToStillUseAnimationWhileExpanding;
BOOL _onlyDisplayHeaderAndFooterViewIfTableViewIsNotEmpty;
UIView *_storedTableHeaderView;
UIView *_storedTableFooterView;
}
여기 UIExpandableTableView의하는 .m 파일의 맨입니다. T
@interface UIExpandableTableView()
@property (nonatomic, retain) NSMutableDictionary *expandableSectionsDictionary;
@property (nonatomic, retain) NSMutableDictionary *showingSectionsDictionary;
@property (nonatomic, retain) NSMutableDictionary *downloadingSectionsDictionary;
@property (nonatomic, retain) NSMutableDictionary *animatingSectionsDictionary;
@property (nonatomic, retain) UIView *storedTableHeaderView;
@property (nonatomic, retain) UIView *storedTableFooterView;
- (void)downloadDataInSection:(NSInteger)section;
- (void)_resetExpansionStates;
@end
이것은 쉬운 해결책 인 것처럼 보이지만 일반적으로 제 3 자 코드를 복사하고 변경하는 대신 서브 클래 싱하는 것이 좋습니다. 그런 생각을 잘못 했나요? – Ramsel
@SmoothAlmonds 나는 변화를 만드는 법을 보여 주려고했지만, 당신이 옳았다면, 하위 클래스를 만드는 것이 더 좋을 것이다. –