我在我的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];
设置正文部分,我需要isHTML
是。
答案 0 :(得分: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];