Я новичок в разработке iOS, я столкнулся с этой проблемой, когда пытался внедрить проект Wheel Rotating с открытым исходным кодом (https://github.com/funkyboy/How-To-Create-a-Rotating-Wheel-Control-with-UIKit) в мой.
По сути, я скопировал соответствующие файлы кода и активы из этого проекта с открытым исходным кодом в свой и внес некоторые необходимые изменения, надеюсь, он будет работать.
«Компонент вращающегося колеса» был из оригинального проекта с открытым исходным кодом, а «Рулетка настроения» — мой проект.
Вот скриншот структуры проекта:
И трассировка стека:
2014-03-10 13:06:12.865 Mood Roulette[13125:60b] cl is 7 | 0.392699, 0.785398, 1.178097
2014-03-10 13:06:12.866 Mood Roulette[13125:60b] -[UCViewController wheelDidChangeValue:]: unrecognized selector sent to instance 0x146d175f0
2014-03-10 13:06:12.869 Mood Roulette[13125:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UCViewController wheelDidChangeValue:]: unrecognized selector sent to instance 0x146d175f0'
*** First throw call stack:
(0x18ba1f09c 0x19799dd78 0x18ba23d14 0x18ba21a7c 0x18b9414ac 0x1000c05fc 0x1000bfb44 0x1000c26f4 0x18e8f42c0 0x18e8f4044 0x18e8fb7dc 0x18e8f8ab0 0x18e96c88c 0x18e9691f0 0x18e9629a0 0x18e8f5530 0x18e8f4720 0x18e9620b0 0x191345128 0x191344c54 0x18b9defc8 0x18b9def28 0x18b9dd14c 0x18b91db38 0x18e9612d4 0x18e95c0e8 0x1000c24b8 0x197f87aa0)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
======
Точка ошибки находится на строке 100
[self.delegate wheelDidChangeValue:[self getCloveName:currentValue]];
кода:
Вот часть, которую я изменил (в основном изменения были сделаны в ViewController
s):
UCAppDelegate.h
:
#import <UIKit/UIKit.h>
//@class UCViewController;
@interface UCAppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
//@property (strong, nonatomic) UCViewController *viewController;
@end
UCAppDelegate.m
:
@implementation UCAppDelegate
//@synthesize window;
//@synthesize viewController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
// self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// self.window.rootViewController = self.viewController;
// [self.window makeKeyAndVisible];
return YES;
}
UCViewController.h
#import <UIKit/UIKit.h>
#import "SMRotaryProtocol.h"
@interface UCViewController : UIViewController
@property (nonatomic, strong) UILabel *valueLabel;
@end
UCViewController.m
:
#import "UCViewController.h"
#import "SMRotaryWheel.h"
@interface UCViewController ()
@end
@implementation UCViewController
@synthesize valueLabel;
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
valueLabel = [[UILabel alloc] initWithFrame:CGRectMake(100, 350, 120, 30)];
valueLabel.textAlignment = NSTextAlignmentCenter;
valueLabel.backgroundColor = [UIColor lightGrayColor];
[self.view addSubview:valueLabel];
SMRotaryWheel *wheel = [[SMRotaryWheel alloc] initWithFrame:CGRectMake(0, 0, 200, 200)
andDelegate:self
withSections:8];
wheel.center = CGPointMake(160, 240);
[self.view addSubview:wheel];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
Проект будет собран без проблем, но оставит черный экран и выдаст ошибку нераспознанного селектора во время работы.
Есть ли что-то, что мне также нужно изменить?
Спасибо за любую помощь.