私はコレクションビューを使用するアプリケーションで作業していましたが、UICollectionViewCellのサブクラスであるカスタムビューセル(カテゴリビューセル)を作成しています。カスタムビューセル(LinkCell)のサブクラスを作成したかったのです。サブクラスでObjective-cエラーが発生しました。
//CategoryViewCell.h
#import <UIKit/UIKit.h>
#import "ViewController.h"
@class ViewController;
@interface CategoryViewCell : UICollectionViewCell
@property (weak, nonatomic) IBOutlet UIImageView *image;
@property (nonatomic) ViewController *parentView;
@property (nonatomic) NSString *cellName;
@end
//CategoryViewCell.m
#import "CategoryViewCell.h"
@implementation CategoryViewCell
@end
//LinkCell.h
#import <UIKit/UIKit.h>
#import "CategoryViewCell.h"
#import "PJP Webview.h"
@interface LinkCell : CategoryViewCell //Error here
@property (nonatomic) NSString *username;
@property (nonatomic) NSString *password;
@property (nonatomic) NSString *urlToLink;
@property (nonatomic) NSString *urlToLinkS;
@property (nonatomic) NSString *urlToLinkP;
@property (nonatomic) NSString *urlToLinkT;
@property (nonatomic) NSString *body;
-(IBAction)celltapped:(id)sender;
@end
//LinkCell.m
#import "LinkCell.h"
@implementation LinkCell
@synthesize urlToLink, username, password, image, cellName, parentView;
-(IBAction)celltapped:(id)sender {
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
NSString *launchString = [NSString stringWithFormat:@"hasLaunched%@Before", self.cellName];
BOOL hasLaunchedCellBefore = [userDefaults boolForKey:launchString];
if (!hasLaunchedCellBefore) {
// first time launch code
hasLaunchedCellBefore = TRUE;
[userDefaults setBool:hasLaunchedCellBefore forKey:launchString];
[userDefaults synchronize];
PJP_Webview *vc = [parentView.storyboard instantiateViewControllerWithIdentifier:@"vc"];
vc.currentCell = self;
[parentView presentViewController:vc animated:YES completion:nil];
}
else {
}
}
@end
誰かがどこにエラーを見せてもらえ「 『LinkCell』のスーパークラス 『をCategoryViewCell』のインタフェース宣言を見つけることができません」私は今、しばらくの間、検索してきたと私はエラーが取得していますなぜ私は見つけることができませんありますか?
あなたはプロジェクトフォルダ(cmd + shift + k)を消去しようとしましたか?再び建築する。 – Joshua
@Joshua、はい私は持っています。私はそれをきれいにするとエラーは消えますが、私がビルドするとすぐにエラーが返されます – SharkbaitWhohaha