2015-07-10 114 views
1

我在调试时遇到了问题。我有一个UITextView在碰触时会崩溃。只有其中一些崩溃,如:帐户类型和增值税季度结束。 这是屏幕的外观崩溃时,如:触摸时UITextField崩溃

enter image description here

这是代码:

@synthesize txtAccType = _txtAccountType; 

- (void)viewDidLoad { 
    [super viewDidLoad]; 
    arrAccountType = [[NSMutableArray alloc] initWithObjects:@"Freelancers", nil]; 

    //self.title = @"Account Setting"; 
    self.title = NSLocalizedString(@"AccountSetting", nil); 

    self.navigationItem.rightBarButtonItem = self.doneBarButtonItem; 

    arrCatId = [[NSMutableArray alloc] init]; 
    arrCategory = [[NSMutableArray alloc] init]; 
    arrTotal = [[NSMutableArray alloc] init]; 

    tag = 0; 
    [svAccountSetting setContentSize:CGSizeMake(280, 600)]; 
    arrCsvData = [[NSMutableArray alloc] init]; 

    quarterEndDatesArray = [[NSArray alloc] initWithObjects: 
       @"April/Jul/Oct/Jan", 
       @"May/Aug/Nov/Feb", 
       @"June/Sep/Dec/Mar", nil]; 

    [self setAcc]; 
} 

-(IBAction)selectAccountType 
{ 
    [self.txtAccType resignFirstResponder]; 
    [svAccountSetting setContentOffset:CGPointMake(0, 6) animated:YES]; 
    [ActionSheetPicker displayActionPickerWithView:self.view data:arrAccountType selectedIndex:self.selectedIndex target:self action:@selector(itemWasSelected:) title: NSLocalizedString(@"Select_Account_Type", nil) ]; 
} 

- (void)itemWasSelected:(NSNumber *)selectedIndexs { 
    //Selection was made 
    self.selectedIndex = [selectedIndexs intValue]; 
    self.txtAccType.text = [arrAccountType objectAtIndex:self.selectedIndex]; 
} 

由于这个项目是年纪大了,我在想,如果一些经验丰富的iOS开发者也许能够帮帮我。

+0

你在调试器中得到什么消息,当它崩溃? –

+0

崩溃的消息? – Aladin

+0

根本没有消息。这是另一件困难的事情。 – Paul

回答

-1

上的UITextView此方法崩溃上,轻触

[ActionSheetPicker displayActionPickerWithView:self.view数据:arrAccountType的selectedIndex:self.selectedIndex目标:自我行动:@选择(itemWasSelected :)标题:NSLocalizedString(@“Select_Account_Type “,无)];

+0

是的,我认为是。但为什么? – Paul

+0

哪个版本的ActionSheetPicker? –

+0

尝试新版本https://github.com/skywinder/ActionSheetPicker-3.0 –

0

尝试设置selectedIndex设置为0第一:

[ActionSheetPicker displayActionPickerWithView:self.view data:arrAccountType selectedIndex:0 target:self action:@selector(itemWasSelected:) title: NSLocalizedString(@"Select_Account_Type", nil) ]; 
+0

对不起,它没有工作。 – Paul