我正在尝试构建要在我的UIButton
中使用的自定义UITableView
,但是当我尝试编译时,我收到以下错误:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_MoreButton", referenced from:
objc-class-ref in MatchCenterViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我已经检查了我的构建设置,据我所知,所有内容都已正确关联,因此我不确定是什么原因引起的。
MatchCenterViewController.h:
#import <UIKit/UIKit.h>
#import <Parse/Parse.h>
#import "AsyncImageView.h"
#import "SearchViewController.h"
#import "WebViewController.h"
#import "SLExpandableTableView.h"
@interface MatchCenterViewController : UIViewController <UITableViewDataSource>
@property (strong, nonatomic) NSString *itemSearch;
@property (strong, nonatomic) NSString *itemPriority;
@property (nonatomic, strong) NSArray *imageURLs;
@property (strong, nonatomic) NSString *matchingCategoryCondition;
@property (strong, nonatomic) NSString *matchingCategoryLocation;
@property (strong, nonatomic) NSNumber *matchingCategoryMaxPrice;
@property (strong, nonatomic) NSNumber *matchingCategoryMinPrice;
@property (strong, nonatomic) NSArray *matchCenterArray;
@property (strong, nonatomic) NSString *searchTerm;
@property (strong, nonatomic) NSString *itemURL;
@property (assign) NSInteger expandedSection;
@property (weak, nonatomic) IBOutlet UIButton *moreButton;
@property (strong) NSMutableSet *expandedSections;
@end
MatchCenterViewController.m(省略了相关部分):
#import "MatchCenterViewController.h"
#import <UIKit/UIKit.h>
@interface MatchCenterViewController () <UITableViewDataSource, UITableViewDelegate>
@property (assign) NSInteger sectionIndex;
@property (nonatomic, strong) UITableView *matchCenter;
@property (nonatomic, assign) BOOL matchCenterDone;
@property (nonatomic, assign) BOOL hasPressedShowMoreButton;
@end
@interface MoreButton : UIButton
@property (assign) NSInteger sectionIndex;
@end
@implementation MatchCenterViewController
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
view.backgroundColor = [UIColor whiteColor];
self.moreButton = [UIButton buttonWithType:UIButtonTypeCustom];
self.moreButton.frame = CGRectMake(0, 0, 320, 44);
[self.moreButton setImage:[UIImage imageNamed:@"downarrow.png"] forState:UIControlStateNormal];
[self.moreButton addTarget:self action:@selector(moreButtonSelected:) forControlEvents:UIControlEventTouchUpInside];
[view addSubview:self.moreButton];
MoreButton *moreButton = [MoreButton buttonWithType:UIButtonTypeCustom];
self.moreButton.frame = CGRectMake(0, 0, 320, 44);
moreButton.sectionIndex = section;
[self.moreButton setImage:[UIImage imageNamed:@"downarrow.png"] forState:UIControlStateNormal];
[moreButton addTarget:self action:@selector(moreButtonSelected:) forControlEvents:UIControlEventTouchUpInside];
[view addSubview:moreButton];
return view;
}
- (void)moreButtonSelected:(MoreButton *)button {
self.expandedSection = button.sectionIndex;
[self.matchCenter reloadData];
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.section == self.expandedSection || indexPath.row <= 3) {
return 65;
}
return 0;
}