简体   繁体   中英

Put Cursor after two lines in body part of MFMailComposeViewController

I am using cursor in my MFMailComposeViewController body part with

- (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;

}

but it is showing cursor on a first character of body part. If want cursor after two lines , like

THIS IS BODY PART FOR MAIL and I want cursor after two lines of this message.

I am using [picker setMessageBody:emailBody isHTML:YES]; for set body part , and I need isHTML YES.

Try this out,

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];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM