0

我在我的MFMailComposeViewController身体部位使用光标

- (BOOL) setMFMailFieldAsFirstResponder:(UIView*)view mfMailField:(NSString*)field{

for (UIView *subview in view.subviews) {
    
    

    NSString *className = [NSString stringWithFormat:@"%@", [subview class]];
    NSLog(@"SubView -- %@ --- %@",className,field);
    
    if ([className isEqualToString:field])
        
    {
        
        //Found the sub view we need to set as first responder
        
        [subview becomeFirstResponder];
        
        return YES;
        
    }
    
    
    
    if ([subview.subviews count] > 0) {
        
        if ([self setMFMailFieldAsFirstResponder:subview mfMailField:field]){
            
            //Field was found and made first responder in a subview
            
           return YES;
            
        }
        
    }
    
}



//field not found in this view.

return NO;

}

但它在身体部位的第一个字符上显示光标。如果想要光标在两行之后,比如

这是邮件的正文部分,我希望将光标放在此消息的两行之后。

我正在使用 [picker setMessageBody:emailBody isHTML:YES];set body part ,我需要isHTMLYES。

4

1 回答 1

0

试试这个,

NSString *emailBody=[NSString stringWithFormat:@"%@<br>Hooray, This is my 2 lines before curser:<br><br>"];
emailbody = [emailBody stringByAppendingString:@"Whatever string or curser you want"];

[picker setMessageBody:emailBody isHTML:YES];
于 2012-05-15T08:26:03.090 回答