vis*_*pak 6 iphone ios4 ios mfmailcomposeviewcontroller
我在我的应用程序中使用MFMailcomposerViewController.一切都很好,除了我需要有没有.收件人和用户发送给的收件人列表.有关此问题的任何帮助或解决方案..
最后我得到了答案并想分享它......我从[博客]得到了很大的帮助:http ://jomnius.blogspot.com/2011/02/how-to-find-mfmailcomposeviewcontroller.html
for (int x=0; x<[emailArray count]-1; x++) {
NSLog(@"%d). %@",x+1,[emailArray objectAtIndex:x]);
NSString *element = [emailArray objectAtIndex:x];
NSArray *arr = [element componentsSeparatedByString:@" & "];
if ([arr count]==1) {
++emailCount;
}
else{
int more = [[[arr objectAtIndex:1] substringToIndex:1] intValue];
emailCount+=(more+1);
}
}
- (NSString *)findEmailAddresses:(UIView *)view depth:(NSInteger)count
{
NSString *eAddress = nil;
if (!view)
return eAddress;
NSMutableString *tabString = [NSMutableString stringWithCapacity:count];
for (int i = 0; i < count; i++)
[tabString appendString:@"-- "];
NSLog(@"%@%@", tabString, view);
if ([view isKindOfClass:[UITextField class]])
{
// MAGIC: debugger shows email address(es) in first textField
// but only if it's about max 35 characters
if (((UITextField *)view).text)
{
eAddress = [NSString stringWithString:((UITextField *)view).text];
NSLog(@"FOUND UITextField: %@", eAddress ? eAddress : @"");
[emailArray addObject:eAddress];
}
}
NSArray *subviews = [view subviews];
if (subviews) {
for (UIView *view in subviews)
{
NSString *s = [self findEmailAddresses:view depth:count+1];
if (s) eAddress = s;
}
}
return eAddress;
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3074 次 |
最近记录: |