簡體   English   中英

UITextView委托方法未觸發

[英]UITextView delegate methods not firing

我的UITextView委托方法沒有觸發。

UILabel *fieldLabel = [[UILabel alloc] initWithFrame:CGRectMake(5, 5, 290, 20)];
fieldLabel.text = nodeproperty.name;
[rowsInSectionLabels addObject:fieldLabel];
UITextView *textViewStatus = [[UITextView alloc] initWithFrame:CGRectMake(5, 25, 290, 30)];
[textViewStatus setTextAlignment:UITextAlignmentLeft];

// For the border and rounded corners
[[textViewStatus layer] setBorderColor:[[UIColor lightGrayColor] CGColor]];
[[textViewStatus layer] setShadowColor:[[UIColor grayColor] CGColor]];
[[textViewStatus layer] setBorderWidth:1];
[[textViewStatus layer] setCornerRadius:5];
[textViewStatus setClipsToBounds: YES];
textViewStatus.delegate = self;
[textViewStatus setEditable:YES];

我的介面

@interface WorkflowViewController : UIViewController <UITextFieldDelegate, UITextViewDelegate, UITableViewDataSource, UITableViewDelegate, UIPickerViewDelegate, UIPickerViewDataSource, PickerRowSelected>

我在這里添加了一個斷點,什么也沒有...

- (void)textViewDidBeginEditing:(UITextView *)textView
{
    MultilineTextViewController *multiLineText = [[MultilineTextViewController alloc] init];
    [self presentModalViewController:multiLineText animated:YES];
}

有任何想法嗎?

我所有其他的委托方法都可以正常工作

好的,我在枚舉時犯了一個愚蠢的錯誤,將UITextView添加到View中,我有一個if語句,它添加了textview或textfield,而if添加textview不能按預期工作,現在一切正常

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM