I have a UIActionSheet to change font of a UITextView. The problem I have is that I have added another UITextView and now wants that it depends on the open UITextView, (I mean open to edit, showing the keyboard) assign me the type of source in one or the other... not be which is the correct property of the UITextView in order to differentiate one from the other depending on the selection.
any idea?
This is the case of a single UITextView.
- (IBAction) displayFontPicker:(id)sender {
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Select a font" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Helvetica", @"Courier", @"Arial", @"Zapfino", @"Verdana", nil];
[actionSheet showFromBarButtonItem:(UIBarButtonItem *)sender animated:YES];
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
NSString *selectedButtonTitle = [actionSheet buttonTitleAtIndex:buttonIndex];
selectedButtonTitle = [selectedButtonTitle lowercaseString];
if ([actionSheet.title isEqualToString:@"Select a font"])
switch (buttonIndex){
case 0:
[_textView setFont:[UIFont fontWithName:@"Helvetica" size:25]];
break;
case 1:
[_textView setFont:[UIFont fontWithName:@"Courier" size:25]];
break;
}
I'm seeing that using the textview , can use a number of methods, in particular this could use it, will run when you start to edit a textview.
(void)textViewDidBeginEditing:(UITextView *)textView
But I don't know how to implement it in my code...