Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2014
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. for (int x=0; x<[emailArray count]-1; x++) {
  2. NSLog(@"%d). %@",x+1,[emailArray objectAtIndex:x]);
  3. NSString *element = [emailArray objectAtIndex:x];
  4. NSArray *arr = [element componentsSeparatedByString:@" & "];
  5. if ([arr count]==1) {
  6. ++emailCount;
  7. }
  8. else{
  9. int more = [[[arr objectAtIndex:1] substringToIndex:1] intValue];
  10. emailCount+=(more+1);
  11. }
  12. }
  13. - (NSString *)findEmailAddresses:(UIView *)view depth:(NSInteger)count
  14. {
  15. NSString *eAddress = nil;
  16. if (!view)
  17. return eAddress;
  18. NSMutableString *tabString = [NSMutableString stringWithCapacity:count];
  19. for (int i = 0; i < count; i++)
  20. [tabString appendString:@"-- "];
  21. NSLog(@"%@%@", tabString, view);
  22. if ([view isKindOfClass:[UITextField class]])
  23. {
  24. // MAGIC: debugger shows email address(es) in first textField
  25. // but only if it's about max 35 characters
  26. if (((UITextField *)view).text)
  27. {
  28. eAddress = [NSString stringWithString:((UITextField *)view).text];
  29. NSLog(@"FOUND UITextField: %@", eAddress ? eAddress : @"");
  30. [emailArray addObject:eAddress];
  31. }
  32. }
  33. NSArray *subviews = [view subviews];
  34. if (subviews) {
  35. for (UIView *view in subviews)
  36. {
  37. NSString *s = [self findEmailAddresses:view depth:count+1];
  38. if (s) eAddress = s;
  39. }
  40. }
  41. return eAddress;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement