Guest User

Untitled

a guest
Oct 8th, 2013
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.06 KB | None | 0 0
  1. RootViewController code of SplitViewController
  2.  
  3. //ContactTableView_iPad.h
  4.  
  5. //
  6. // ContactTableView_iPad.h
  7. //
  8.  
  9.  
  10. #import <UIKit/UIKit.h>
  11. #import "LoadingViewClass.h"
  12. #import "CMPopTipView.h"
  13. #import "ContactContainer_iPad.h"
  14.  
  15. @class DetailView_iPad;
  16. @class AppDelegate;
  17. @class ContactContainer_iPad;
  18.  
  19. @interface ContactTableView_iPad : UITableViewController<NSXMLParserDelegate, CMPopTipViewDelegate>
  20. {
  21. AppDelegate *appdelegate;
  22.  
  23. LoadingViewClass *loading;
  24.  
  25. CMPopTipView *popTipView;
  26.  
  27. UISplitViewController *splitViewController;
  28.  
  29. NSArray *names,*id1;
  30. NSMutableArray *arrayOfCharacters;
  31. NSMutableDictionary *objectsForCharacters;
  32. NSMutableArray *arrayFinal;
  33.  
  34. NSArray *vendorNameArray,*vendorIdArray;
  35. NSArray *clientNameArray,*clientIdArray;
  36.  
  37. IBOutlet UISearchBar *serachBar;
  38. NSMutableArray *searchArray;
  39. NSMutableArray *dataArray;
  40.  
  41. BOOL recordResults;
  42. NSMutableData *webData1;
  43. NSMutableString *soapResults;
  44. NSXMLParser *xmlParser;
  45. NSXMLParser *xmlParser1;
  46.  
  47. NSString *reloadFlag;
  48.  
  49. NSURLConnection *connection1;
  50.  
  51. UIActivityIndicatorView *indicator;
  52.  
  53. NSString *conId,*fName,*lName;
  54. NSString *serviceName,*serviceId;
  55.  
  56. NSMutableArray *RecentContactNameArray2;
  57. NSMutableArray *RecentContactIdArray2;
  58. }
  59.  
  60. @property (nonatomic, retain) IBOutlet DetailView_iPad *detailViewController;
  61.  
  62. @property (nonatomic, retain) IBOutlet ContactTableView_iPad *tableViewController;
  63.  
  64. @property(nonatomic,retain) IBOutlet UIButton *FilterButton;
  65. @property (nonatomic, retain) NSArray *names,*id1;
  66. @property (nonatomic, retain) NSArray *vendorNameArray,*vendorIdArray;
  67. @property (nonatomic, retain) NSArray *clientNameArray,*clientIdArray;
  68.  
  69. @property (nonatomic, retain)NSMutableArray *RecentContactNameArray2;
  70. @property (nonatomic, retain)NSMutableArray *RecentContactIdArray2;
  71.  
  72. @property (nonatomic, retain) NSMutableArray *arrayOfCharacters;
  73. @property (nonatomic, retain) NSMutableDictionary *objectsForCharacters;
  74.  
  75. @property(nonatomic,retain) NSMutableData *webData;
  76. @property(nonatomic, retain) NSXMLParser *xmlParser;
  77. @property(nonatomic, retain) NSMutableString *firstName,*lastName,*sElmentString;
  78.  
  79. @property(nonatomic,retain) IBOutlet UITableView *ContactTableview;
  80.  
  81. @property(nonatomic,retain) NSMutableArray *conNameArray,*conIdArray;
  82. @property(nonatomic,retain) NSMutableArray *conNameArray1,*conIdArray1;
  83. @property(nonatomic,retain) NSMutableArray *conNameArray2,*conIdArray2;
  84.  
  85. -(IBAction)HomeBtn:(id)sender;
  86. -(IBAction)backbtn:(id)sender;
  87.  
  88. -(IBAction)RefreshBtn:(id)sender;
  89.  
  90. - (void)setupIndexData;
  91.  
  92. - (void)filterMethod;
  93.  
  94. @end
  95.  
  96.  
  97.  
  98.  
  99.  
  100. //ContactTableView_iPad.m
  101.  
  102. //
  103. // ContactTableView_iPad.m
  104. // SPANPLAN
  105. //
  106. // Created by SPAN Technology on 9/30/13.
  107. // Copyright (c) 2013 SPAN TECHNOLOGY. All rights reserved.
  108. //
  109.  
  110. #import "ContactTableView_iPad.h"
  111. #import "DetailView_iPad.h"
  112. #import "AppDelegate.h"
  113. #import "BackgroundLayer.h"
  114. #import "Reachability.h"
  115. #import "Errormsg.h"
  116. #import "AddContact.h"
  117. #import "MenuView.h"
  118.  
  119. @interface ContactTableView_iPad ()
  120.  
  121. @end
  122.  
  123. @implementation ContactTableView_iPad
  124.  
  125. @synthesize RecentContactIdArray2,RecentContactNameArray2;
  126. @synthesize names,id1;
  127. @synthesize vendorIdArray,vendorNameArray;
  128. @synthesize clientIdArray,clientNameArray;
  129. @synthesize arrayOfCharacters;
  130. @synthesize objectsForCharacters;
  131. @synthesize conIdArray1,conNameArray1,conIdArray2,conNameArray2,conIdArray,conNameArray;
  132. @synthesize webData;
  133. @synthesize xmlParser,firstName,sElmentString,lastName,FilterButton;
  134.  
  135. @synthesize ContactTableview;
  136.  
  137. @synthesize detailViewController;
  138.  
  139. - (id)initWithStyle:(UITableViewStyle)style
  140. {
  141. self = [super initWithStyle:style];
  142. if (self) {
  143. // Custom initialization
  144. }
  145. return self;
  146. }
  147.  
  148. - (void)viewDidLoad
  149. {
  150. appdelegate = (AppDelegate*)[[UIApplication sharedApplication]delegate];
  151.  
  152. NSLog(@"viewDidLoad appdelegate.RecentNameArray1....... %@",appdelegate.RecentNameArray1);
  153.  
  154. // if([reloadFlag isEqualToString:@"recent"])
  155. // {
  156. // [self recentContact];
  157. // }
  158. // else if([reloadFlag isEqualToString:@"vendor"])
  159. // {
  160. // [self vendorContact];
  161. // }
  162. // else if([reloadFlag isEqualToString:@"all"])
  163. // {
  164. // [self allContact];
  165. // }
  166. // else if([reloadFlag isEqualToString:@"client"])
  167. // {
  168. // [self clientContact];
  169. // }
  170. // else
  171. // {
  172. // [self reload];
  173. // }
  174.  
  175.  
  176. [super viewDidLoad];
  177.  
  178. self.view.frame = CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y, (self.view.frame.size.width), self.view.frame.size.height-104);
  179.  
  180. // Uncomment the following line to preserve selection between presentations.
  181. // self.clearsSelectionOnViewWillAppear = NO;
  182.  
  183. // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
  184. // self.navigationItem.rightBarButtonItem = self.editButtonItem;
  185.  
  186. self.navigationController.navigationBar.hidden=YES;
  187.  
  188. [self.tableView reloadData];
  189. [ContactTableview reloadData];
  190.  
  191.  
  192. }
  193. - (void)viewWillAppear:(BOOL)animated
  194. {
  195.  
  196. self.navigationController.navigationBarHidden = YES;
  197. [super viewWillAppear:animated];
  198.  
  199. // CAGradientLayer *bgLayer3 = [BackgroundLayer blueGradient1];
  200. // bgLayer3.frame = self.view.bounds;
  201. // [self.view.layer insertSublayer:bgLayer3 atIndex:0];
  202.  
  203. [FilterButton setImage:[UIImage imageNamed:@"nav_menu_icon"] forState:UIControlStateNormal];
  204. [FilterButton setContentEdgeInsets:UIEdgeInsetsMake(0, 4, 0, 0)];
  205.  
  206. [self reload];
  207.  
  208. NSString *ContactIdStr=[NSString stringWithFormat:@"%@",[[objectsForCharacters objectForKey:[arrayOfCharacters objectAtIndex:0]] objectAtIndex:0]];
  209.  
  210.  
  211. NSArray *afterSeprate = [[NSArray alloc]init];
  212. afterSeprate = [ContactIdStr componentsSeparatedByString:@"+"];
  213. NSString *detailText = [afterSeprate objectAtIndex:1];
  214.  
  215. appdelegate.contactId=[NSString stringWithString:detailText];
  216.  
  217. NSLog(@"viewWillAppear appdelegate.RecentNameArray1..... %@",appdelegate.RecentNameArray1);
  218.  
  219.  
  220. }
  221.  
  222. - (void)viewDidUnload
  223. {
  224. conIdArray = nil;
  225. conNameArray = nil;
  226.  
  227. conIdArray1 = nil;
  228. conNameArray1 = nil;
  229.  
  230. conIdArray2 = nil;
  231. conNameArray2 = nil;
  232.  
  233. RecentContactNameArray2 = nil;
  234. RecentContactIdArray2 = nil;
  235.  
  236. [super viewDidUnload];
  237. // Release any retained subviews of the main view.
  238. // e.g. self.myOutlet = nil;
  239. }
  240.  
  241. - (void)didReceiveMemoryWarning
  242. {
  243. [super didReceiveMemoryWarning];
  244. // Dispose of any resources that can be recreated.
  245. }
  246.  
  247. #pragma mark - Table view data source
  248.  
  249. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  250. {
  251. // Return the number of sections.
  252. if([serachBar.text isEqualToString:@""] || serachBar.text == nil)
  253. return [arrayOfCharacters count];
  254. else
  255. return 1;
  256. }
  257.  
  258. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  259. {
  260. // Return the number of rows in the section.
  261. if([serachBar.text isEqualToString:@""] || serachBar.text == nil)
  262. return [[objectsForCharacters objectForKey:[arrayOfCharacters objectAtIndex:section]] count];
  263. else
  264. return [searchArray count];
  265. }
  266.  
  267. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  268. {
  269. NSLog(@"Reload");
  270.  
  271. static NSString *CellIdentifier = @"Cell";
  272.  
  273. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  274.  
  275. if (cell == nil) {
  276.  
  277. cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
  278. cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
  279.  
  280.  
  281. }
  282.  
  283. if([serachBar.text isEqualToString:@""] || serachBar.text == nil)
  284. {
  285.  
  286. NSString *totalString = [[objectsForCharacters objectForKey:[arrayOfCharacters objectAtIndex:indexPath.section]] objectAtIndex:indexPath.row];
  287. NSArray *afterSeprate = [[NSArray alloc]init];
  288. afterSeprate = [totalString componentsSeparatedByString:@"+"];
  289. NSString *cellText = [afterSeprate objectAtIndex:0];
  290. //NSString *detailText = [afterSeprate objectAtIndex:1];
  291. cell.textLabel.text = cellText;
  292. //cell.detailTextLabel.text=detailText;
  293. cell.textLabel.textColor=[UIColor blackColor];
  294. cell.imageView.image=[UIImage imageNamed:@"Profile.png"];
  295.  
  296. NSLog(@"cellText.....%@",cellText);
  297. }
  298. else
  299. {
  300. NSArray *afterSeprate = [[NSArray alloc]init];
  301. afterSeprate = [[searchArray objectAtIndex:indexPath.row] componentsSeparatedByString:@"+"];
  302. NSString *cellText = [afterSeprate objectAtIndex:0];
  303. //NSString *detailText = [afterSeprate objectAtIndex:1];
  304. cell.textLabel.text = cellText;
  305. //cell.detailTextLabel.text=detailText;
  306. cell.textLabel.textColor=[UIColor blackColor];
  307. cell.imageView.image=[UIImage imageNamed:@"Profile.png"];
  308.  
  309. NSLog(@"cellText...123.....%@",cellText);
  310. }
  311.  
  312. return cell;
  313. }
  314.  
  315. - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
  316.  
  317. if([serachBar.text isEqualToString:@""] || serachBar.text == nil)
  318. {
  319. if ([arrayOfCharacters count] == 0) {
  320. return @"";
  321. }
  322.  
  323. return [NSString stringWithFormat:@"%@", [arrayOfCharacters objectAtIndex:section]];
  324. }
  325. else
  326. {
  327. return 0;
  328. }
  329. }
  330.  
  331. - (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView {
  332.  
  333. if([serachBar.text isEqualToString:@""] || serachBar.text == nil)
  334. {
  335.  
  336. NSMutableArray *toBeReturned = [[NSMutableArray alloc] init];
  337. [toBeReturned addObject:@"A"];
  338. [toBeReturned addObject:@"B"];
  339. [toBeReturned addObject:@"C"];
  340. [toBeReturned addObject:@"D"];
  341. [toBeReturned addObject:@"E"];
  342. [toBeReturned addObject:@"F"];
  343. [toBeReturned addObject:@"G"];
  344. [toBeReturned addObject:@"H"];
  345. [toBeReturned addObject:@"I"];
  346. [toBeReturned addObject:@"J"];
  347. [toBeReturned addObject:@"K"];
  348. [toBeReturned addObject:@"L"];
  349. [toBeReturned addObject:@"M"];
  350. [toBeReturned addObject:@"N"];
  351. [toBeReturned addObject:@"O"];
  352. [toBeReturned addObject:@"P"];
  353. [toBeReturned addObject:@"Q"];
  354. [toBeReturned addObject:@"R"];
  355. [toBeReturned addObject:@"S"];
  356. [toBeReturned addObject:@"T"];
  357. [toBeReturned addObject:@"U"];
  358. [toBeReturned addObject:@"V"];
  359. [toBeReturned addObject:@"W"];
  360. [toBeReturned addObject:@"X"];
  361. [toBeReturned addObject:@"Y"];
  362. [toBeReturned addObject:@"Z"];
  363. [toBeReturned addObject:@"#"];
  364.  
  365. return toBeReturned;
  366.  
  367. }
  368. else
  369. {
  370. return 0;
  371. }
  372. }
  373.  
  374. - (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index {
  375.  
  376. if([serachBar.text isEqualToString:@""] || serachBar.text == nil)
  377. {
  378. NSInteger count = 0;
  379.  
  380. for (NSString *character in arrayOfCharacters) {
  381.  
  382. if ([character isEqualToString:title]) {
  383. return count;
  384. }
  385.  
  386. count ++;
  387. }
  388. }
  389. else
  390. {
  391. return 0;
  392. }
  393.  
  394. return 0;// in case of some eror donot crash d application
  395. }
  396.  
  397.  
  398. #pragma mark - Table view delegate
  399.  
  400. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  401. {
  402. // Navigation logic may go here. Create and push another view controller.
  403.  
  404.  
  405. if([serachBar.text isEqualToString:@""] || serachBar.text == nil)
  406. {
  407. NSString *ContactIdStr=[NSString stringWithFormat:@"%@",[[objectsForCharacters objectForKey:[arrayOfCharacters objectAtIndex:indexPath.section]] objectAtIndex:indexPath.row]];
  408.  
  409.  
  410. NSArray *afterSeprate = [[NSArray alloc]init];
  411. afterSeprate = [ContactIdStr componentsSeparatedByString:@"+"];
  412. //NSString *cellText = [afterSeprate objectAtIndex:0];
  413. NSString *detailText = [afterSeprate objectAtIndex:1];
  414.  
  415. appdelegate.contactId=[NSString stringWithString:detailText];
  416.  
  417. }
  418. else
  419. {
  420. serachBar.text = nil;
  421. NSString *ContactIdStr=[NSString stringWithFormat:@"%@",[searchArray objectAtIndex:indexPath.row]];
  422.  
  423. NSArray *afterSeprate = [[NSArray alloc]init];
  424. afterSeprate = [ContactIdStr componentsSeparatedByString:@"+"];
  425. //NSString *cellText = [afterSeprate objectAtIndex:0];
  426. NSString *detailText = [afterSeprate objectAtIndex:1];
  427.  
  428. appdelegate.contactId=[NSString stringWithString:detailText];
  429.  
  430. }
  431.  
  432.  
  433. // Pass the selected object to the new view controller.
  434.  
  435.  
  436. DetailView_iPad *event = [[DetailView_iPad alloc]initWithNibName:@"DetailView_iPad" bundle:nil];
  437. [detailViewController.navigationController pushViewController:event animated:YES];
  438.  
  439.  
  440. [self.tableView deselectRowAtIndexPath:indexPath animated:YES];
  441.  
  442. }
  443.  
  444. - (void)setupIndexData {
  445.  
  446. self.arrayOfCharacters = [[NSMutableArray alloc] init];
  447. self.objectsForCharacters = [[NSMutableDictionary alloc] init];
  448.  
  449. NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
  450. NSMutableArray *arrayOfNames = [[NSMutableArray alloc] init];
  451. NSString *numbericSection = @"#";
  452. NSString *firstLetter;
  453.  
  454. NSLog(@"ArrayFinal..%@",arrayFinal);
  455.  
  456. for (NSString *item in arrayFinal)
  457. {
  458.  
  459. firstLetter = [[item description] substringToIndex:1];
  460.  
  461. // Check if it's NOT a number
  462. if ([formatter numberFromString:firstLetter] == nil)
  463. {
  464. /**
  465. * If the letter doesn't exist in the dictionary go ahead and add it the
  466. * dictionary.
  467. *
  468. * ::IMPORTANT::
  469. * You HAVE to removeAllObjects from the arrayOfNames or you will have an N + 1
  470. * problem. Let's say that start with the A's, well once you hit the
  471. * B's then in your table you will the A's and B's for the B's section. Once
  472. * you hit the C's you will all the A's, B's, and C's, etc.
  473. */
  474. firstLetter = [firstLetter uppercaseString];
  475.  
  476. if (![objectsForCharacters objectForKey:firstLetter])
  477. {
  478. [arrayOfNames removeAllObjects];
  479. [arrayOfCharacters addObject:firstLetter];
  480. }
  481.  
  482. [arrayOfNames addObject:[item description]];
  483.  
  484. /**
  485. * Need to autorelease the copy to preven potential leak. Even though the
  486. * arrayOfNames is released below it still has a retain count of +1
  487. */
  488. [objectsForCharacters setObject:[arrayOfNames copy] forKey:firstLetter];
  489.  
  490. }
  491. else
  492. {
  493.  
  494. if (![objectsForCharacters objectForKey:numbericSection])
  495. {
  496.  
  497. [arrayOfNames removeAllObjects];
  498.  
  499. [arrayOfCharacters addObject:numbericSection];
  500. }
  501.  
  502. [arrayOfNames addObject:[item description]];
  503.  
  504. [objectsForCharacters setObject:[arrayOfNames copy] forKey:numbericSection];
  505. }
  506. }
  507. for(NSString *key in objectsForCharacters){
  508. NSArray *array = [objectsForCharacters valueForKey:key];
  509. [array enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
  510. [dataArray addObject:obj];
  511. }];
  512. }
  513.  
  514. NSLog(@"arrayOfCharacters ::123 %@",arrayOfCharacters);
  515.  
  516. // COULDN"T RELOAD TABLEVIEW HERE.. TRIED ALL THE FOLLOWING CODES TO RELOAD BUT NOTHING WORKED
  517.  
  518. // [self.ContactTableview.dataSource tableView:ContactTableview cellForRowAtIndexPath:1];
  519.  
  520. //[self.tableView reloadData];
  521. [ContactTableview reloadData];
  522. //// [self.tableViewController.tableView reloadData];
  523. //// [self.tableViewController.ContactTableview reloadData];
  524. ////
  525. //// [self.tableView cellForRowAtIndexPath:0];
  526. ////
  527. [self.ContactTableview cellForRowAtIndexPath:0];
  528. // [self.tableView clearsContextBeforeDrawing];
  529. //
  530. [self.tableView reloadData];
  531.  
  532. // [self.ContactTableview reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationNone];
  533. // [self.ContactTableview reloadData];
  534.  
  535. }
  536.  
  537.  
  538.  
  539. # pragma mark - Other Methods
  540.  
  541.  
  542. -(void)reload
  543. {
  544. NSLog(@"Reload Method Called");
  545.  
  546. reloadFlag=@"";
  547.  
  548. arrayFinal = [[NSMutableArray alloc]init];
  549. for(int i=0; i<[appdelegate.names1 count]; i++)
  550. {
  551. NSString *string = [NSString stringWithFormat:@"%@+%@",[appdelegate.names1 objectAtIndex:i],[appdelegate.id2 objectAtIndex:i]];
  552. [arrayFinal addObject:string];
  553. }
  554.  
  555. arrayFinal = (NSMutableArray *)[arrayFinal sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
  556.  
  557. searchArray = [[NSMutableArray alloc]init];
  558. dataArray = [[NSMutableArray alloc]init];
  559.  
  560. [self setupIndexData];
  561.  
  562. }
  563.  
  564. -(IBAction)clickAddContact:(id)sender
  565. {
  566. if ([appdelegate.PrivilegeAccess containsObject:@"21"])
  567. {
  568. AddContact *addcontact = [[AddContact alloc]init];
  569. [self.navigationController pushViewController:addcontact animated:YES];
  570. }
  571. else
  572. {
  573. [self dismissAllPopTipViews];
  574. NSString *contentMessage = nil;
  575. contentMessage = @"Not Authorized";
  576. popTipView = [[CMPopTipView alloc] initWithMessage:contentMessage];
  577. popTipView.delegate = self;
  578. [popTipView autoDismissAnimated:YES atTimeInterval:3.0];
  579. UIButton *button = (UIButton *)sender;
  580. [popTipView presentPointingAtView:button inView:self.view animated:YES];
  581. }
  582. }
  583.  
  584.  
  585. - (void)dismissAllPopTipViews
  586. {
  587. [popTipView dismissAnimated:YES];
  588. }
  589.  
  590. - (void)popTipViewWasDismissedByUser:(CMPopTipView *)popTipView
  591. {
  592. //self.currentPopTipViewTarget = nil;
  593. }
  594.  
  595. -(void) filterMethod
  596. {
  597. appdelegate = (AppDelegate*)[[UIApplication sharedApplication]delegate];
  598.  
  599. NSLog(@"Filter Method");
  600. NSLog(@"Filter appdelegate.RecentNameArray1 Contacts..%@",appdelegate.RecentNameArray1);
  601. CustomAlertView *customAlertView = [[CustomAlertView alloc]initWithTitle:@"Contacts"
  602. message:@"Select Option"
  603. delegate:self
  604. cancelButtonTitle:nil
  605. otherButtonTitles:@"Recent Contacts",@"Clients",@"Vendors",@"All", nil];
  606. [customAlertView show];
  607.  
  608. }
  609.  
  610. - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
  611. {
  612. switch (buttonIndex)
  613. {
  614. case 0: //red
  615. [self recentContact];
  616. break;
  617. case 1: //red
  618. [self clientContact];
  619. break;
  620. case 2:
  621. [self vendorContact];
  622. break;
  623. case 3: //blue
  624. [self allContact];
  625. break;
  626. default:
  627. break;
  628. }
  629. }
  630.  
  631. -(void)recentContact
  632. {
  633. NSLog(@"Recent Contacts");
  634.  
  635. arrayFinal = [[NSMutableArray alloc]init];
  636. for(int i=0; i<[appdelegate.RecentNameArray1 count]; i++)
  637. {
  638. NSString *string = [NSString stringWithFormat:@"%@+%@",[appdelegate.RecentNameArray1 objectAtIndex:i],[appdelegate.RecentIdArray1 objectAtIndex:i]];
  639. [arrayFinal addObject:string];
  640. }
  641.  
  642. arrayFinal = (NSMutableArray *)[arrayFinal sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
  643.  
  644. searchArray = [[NSMutableArray alloc]init];
  645. dataArray = [[NSMutableArray alloc]init];
  646.  
  647. [self setupIndexData];
  648.  
  649.  
  650. }
  651.  
  652. -(void)allContact
  653. {
  654. NSLog(@"All Contacts");
  655.  
  656. arrayFinal = [[NSMutableArray alloc]init];
  657. for(int i=0; i<[appdelegate.names1 count]; i++)
  658. {
  659. NSString *string = [NSString stringWithFormat:@"%@+%@",[appdelegate.names1 objectAtIndex:i],[appdelegate.id2 objectAtIndex:i]];
  660. [arrayFinal addObject:string];
  661. }
  662.  
  663. arrayFinal = (NSMutableArray *)[arrayFinal sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
  664.  
  665. searchArray = [[NSMutableArray alloc]init];
  666. dataArray = [[NSMutableArray alloc]init];
  667.  
  668. [self setupIndexData];
  669.  
  670.  
  671. }
  672. -(void)vendorContact
  673. {
  674. NSLog(@"Vendor Contacts");
  675.  
  676. arrayFinal = [[NSMutableArray alloc]init];
  677. for(int i=0; i<[appdelegate.vendorNameArray1 count]; i++)
  678. {
  679. NSString *string = [NSString stringWithFormat:@"%@+%@",[appdelegate.vendorNameArray1 objectAtIndex:i],[appdelegate.vendorIdArray1 objectAtIndex:i]];
  680. [arrayFinal addObject:string];
  681. }
  682.  
  683. arrayFinal = (NSMutableArray *)[arrayFinal sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
  684.  
  685. searchArray = [[NSMutableArray alloc]init];
  686. dataArray = [[NSMutableArray alloc]init];
  687.  
  688. [self setupIndexData];
  689.  
  690. }
  691. -(void)clientContact
  692. {
  693. NSLog(@"Client Contacts");
  694.  
  695. arrayFinal = [[NSMutableArray alloc]init];
  696. for(int i=0; i<[appdelegate.clientNameArray1 count]; i++)
  697. {
  698. NSString *string = [NSString stringWithFormat:@"%@+%@",[appdelegate.clientNameArray1 objectAtIndex:i],[appdelegate.clientIdArray1 objectAtIndex:i]];
  699. [arrayFinal addObject:string];
  700. }
  701.  
  702. arrayFinal = (NSMutableArray *)[arrayFinal sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
  703.  
  704. searchArray = [[NSMutableArray alloc]init];
  705. dataArray = [[NSMutableArray alloc]init];
  706.  
  707. [self setupIndexData];
  708.  
  709. }
  710. @end
Advertisement
Add Comment
Please, Sign In to add comment