Grouper / FlatUIKit

A collection of awesome flat UI components for iOS.
MIT License
7.79k stars 948 forks source link

FUIButton Not working in iOS7.1 #153

Closed superadmin84 closed 9 years ago

superadmin84 commented 10 years ago

I have a button that I am trying to style with FlatUIKit, but It crashes the app. My code is as follows:

.h:

import <UIKit/UIKit.h>

import "FUISwitch.h"

import "FUIButton.h"

@interface setup1ViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>

@property (nonatomic,strong) NSMutableArray medias; @property (strong, nonatomic) IBOutlet UITableView oneTableView; @property (weak, nonatomic) IBOutlet UIView cellBackground; @property (weak, nonatomic) IBOutlet FUIButton nextButton;

@end

.m:

import "ViewController.h

import "FUISwitch.h"

import "UIFont+FlatUI.h"

import "UIColor+FlatUI.h"

import "FUIButton.h"

self.nextButton.buttonColor = [UIColor turquoiseColor]; self.nextButton.shadowColor = [UIColor greenSeaColor]; self.nextButton.shadowHeight = 3.0f; self.nextButton.cornerRadius = 6.0f; self.nextButton.titleLabel.font = [UIFont boldFlatFontOfSize:16]; [self.nextButton setTitleColor:[UIColor cloudsColor] forState:UIControlStateNormal]; [self.nextButton setTitleColor:[UIColor cloudsColor] forState:UIControlStateHighlighted];

with error:

2014-06-22 18:10:28.970 Social Me[32843:60b] -[UIButton setButtonColor:]: unrecognized selector sent to instance 0x10ac12800 2014-06-22 18:10:28.985 Social Me[32843:60b] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIButton setButtonColor:]: unrecognized selector sent to instance 0x10ac12800' * First throw call stack: ( 0 CoreFoundation 0x0000000101fe5495 exceptionPreprocess + 165 1 libobjc.A.dylib 0x0000000101d4499e objc_exception_throw + 43 2 CoreFoundation 0x000000010207665d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205 3 CoreFoundation 0x0000000101fd6d8d __forwarding + 973 4 CoreFoundation 0x0000000101fd6938 _CF_forwarding_prep_0 + 120 5 Social Me 0x00000001000028b1 -[setup1ViewController viewDidLoad] + 337 6 UIKit 0x0000000100baa59e -[UIViewController loadViewIfRequired] + 562 7 UIKit 0x0000000100baa777 -[UIViewController view] + 29 8 UIKit 0x0000000100bc12c5 -[UINavigationController _startCustomTransition:] + 628 9 UIKit 0x0000000100bcc6f5 -[UINavigationController _startDeferredTransitionIfNeeded:] + 401 10 UIKit 0x0000000100bcd238 -[UINavigationController __viewWillLayoutSubviews] + 43 11 UIKit 0x0000000100ce7895 -[UILayoutContainerView layoutSubviews] + 202 12 UIKit 0x0000000100b14993 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 354 13 QuartzCore 0x0000000100943802 -[CALayer layoutSublayers] + 151 14 QuartzCore 0x0000000100938369 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 363 15 QuartzCore 0x00000001009381ea _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24 16 QuartzCore 0x00000001008abfb8 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 252 17 QuartzCore 0x00000001008ad030 _ZN2CA11Transaction6commitEv + 394 18 UIKit 0x0000000100ab3024 _UIApplicationHandleEventQueue + 10914 19 CoreFoundation 0x0000000101f74d21 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 20 CoreFoundation 0x0000000101f745f2 CFRunLoopDoSources0 + 242 21 CoreFoundation 0x0000000101f9046f CFRunLoopRun + 767 22 CoreFoundation 0x0000000101f8fd83 CFRunLoopRunSpecific + 467 23 GraphicsServices 0x0000000103a2bf04 GSEventRunModal + 161 24 UIKit 0x0000000100ab4e33 UIApplicationMain + 1010 25 Social Me 0x000000010000ed03 main + 115 26 libdyld.dylib 0x0000000102a3e5fd start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)

pronebird commented 10 years ago

Your forgot to set a class for button in IB.