在loadFromNib中自定义View崩溃

时间:2017-08-10 06:33:08

标签: ios objective-c crash

我已检查所有出口和连接似乎都很好。如果有的话,可以查看一下并发现故障。基本上,当用户移出指定区域时,此自定义视图显示在视图控制器上。

//  QMOutOfCountryView.m

 #import "QMOutOfCountryView.h"

 @implementation QMOutOfCountryView
 /*
 // Only override drawRect: if you perform custom drawing.
 // An empty implementation adversely affects performance during animation.
 - (void)drawRect:(CGRect)rect {
     // Drawing code
 }
 */

 +(QMOutOfCountryView*)loadFromNib{
     NSArray *nibArr = [[NSBundle mainBundle] loadNibNamed:@"QMOutOfCountryView" owner:self options:nil];
     QMOutOfCountryView *countryView;
     for (UIView * subview in nibArr) {
         if ([subview isKindOfClass:[QMOutOfCountryView class]]) {
             countryView = (QMOutOfCountryView *)subview;
             break;
         }
     }
     return countryView;
 }
 -(void)setdataOnViewWith:(int)viewType {
     if (viewType == location) {
         iconImage.image = [UIImage imageNamed:@"locationoff"];
         messageTextView.text = kLocationViewMessage;
     } else if (viewType == outOfCountry) {
         iconImage.image = [UIImage imageNamed:@"illustration"];
         messageTextView.text = kOutOfCountryViewMessage;
     }
     messageTextView.textColor = [UIColor blackColor];
     messageTextView.font = [UIFont fontWithName:@"SFUIDisplay-Light" size:16.0f];
 }
 @end

0 个答案:

没有答案