iOS Group Address Book effects + side-slip menu (Mmdrawercontroller)

Source: Internet
Author: User

Preface to the Nonsense ... Can ignore
Ever since I learned to use cocoapod, I can't stop! Because it's so simple and awesome, you don't have to stick your source code in project!
See the commentary in the Camp David blog: Cocoapod Installation and use
First of all, please forgive me the effect of the record is not very good, it is basically the meaning

The next code!

1. Contacts

The basic of the Address Book is the Association of the Index bar and section, followed by the initialization of the index column data and the title of each section. About the index bar data, assuming that the small brother of the interface will help you return to ABCD directly ... Suppose very unfortunate, the interface small brother does not give you to return the index column data, then must handle! (The processing method might be re-made, and now assume that the index column data is received first)

(1.) Private members

 @property(nonatomic,strong)NSArray* bottomTableData; @property(nonatomic,strong)NSArray* indexData;

(2.) Related functions

    //每一个section 的title- (UIView *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{    return [_indexData objectAtIndex:section];}//返回索引栏数据- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView{    return _indexData;}//建立索引栏和section的关联     - (NSInteger)tableView:(UITableView *)tableView             sectionForSectionIndexTitle:(NSString *)title                    atIndex:(NSInteger)index{  NSInteger section = [_indexData indexOfObject:title];  return section;}
2. Side Slide Menu

(1.) Private members

(2.) Related functions

    1> Initialize the data in Viewdidload 2> set the side-slip menu (using Mmdrawercontroller)! leftsidedrawerviewcontroller* Leftmenucontroller = [[Leftsidedrawerviewcontroller alloc] init]; Leftmenucontroller.imgdata = @[@ "Allfriend", @ "Jiaren", @ "pengyou", @ "Tongxue", @ "Weifenzu"];/** Note: Each page should be wrapped with navigationviewcontroller. I am not writing on the main page of the side-slip menu, but in the modal form of writing. Here the number of participants need to be carefully checked, very easy error, assuming the number of errors, the interface effect will be problematic, You can try to modify it in detail and have a deep understanding of it. My self here is a viewcontroller, so I need to navigationviewcontroller a layer. */self.drawcontroller = [[ Mmdrawercontroller alloc] Initwithcenterviewcontroller:[[navigationviewcontroller alloc] Initwithrootviewcontroller:self] Leftdrawerviewcontroller:leftcontroller]; [_drawcontroller Setshowsshadow:no]; [_drawcontroller SETMAXIMUMLEFTDRAWERWIDTH:KSCREENWIDTH*4/5]; [_drawcontroller Setopendrawergesturemodemask:mmopendrawergesturemodeall]; [_drawcontroller Setclosedrawergesturemodemask:mmclosedrawergesturemodeall];_window = [[UIWindow alloc] Initwithframe:[[uiscreen Mainscreen] bounds]; Uicolor * Tintcolor = [Uicolor colorwithred:29.0/255.0 green:173.0/255.0 blue:234.0/255.0 ALPHA:1.0]; [_window settintcolor:tintcolor];_window.rootviewcontroller = _drawcontroller; [_window makekeyandvisible];3> initialize data _toptabledata = @[@[@ "new friends (0)", @ "qunmemberaction"],@[@ "my Fans (0)", @ "    Qunweiboaction "],@[@" my Group (0), @ "Qunmemberaction"]; _bottomtabledata = @[@[@ "Ah 1", @ "Ah 2"],@[@ "Bobo", @ "spinach"],@[@ "hehe"],@[@ "school inside and outside assistant", @ "newcomer", @ "villain", @ "xin person"]];_indexdata = @[@ "A", @ "B "@" H ", @" X "];_leftmenudata = @[@" All Friends (2) ", @" family (0) ", @" Friends (0) ", @" classmate (0) "@" ungrouped (2) "];4> Select an item in the left side menu, The slide menu closes and refreshes the data on the main page a. Side slide menu. m medium-(void) TableView: (UITableView *) TableView Didselectrowatindexpath: (Nsindexpath *) indexpath{contactsviewcontroller* Contactcontroller = [[Contactsviewcontroller alloc] initwithnibname:@ "    Contactsviewcontroller "Bundle:nil";    Self.leftdelegate = Contactcontroller; [Self.leftdelegate passtocontacts:[nsstring stringwithformat:@ "%ld", (long) Indexpath.row]]; [Self.mm_drawercontroller Closedraweranimated:yes completion:nil];}  B. Main page. m medium-(void) Passtocontacts: (nsstring*) value{//Once again request friend contacts and refresh TableView groupindex = [value intvalue]; [Self viewdidload];}
3. Return to the previous level page from the main page
//更改window的根视图控制器- (void)pressCancleBtn:(id)sender{    TabbarViewController* tabbarController =  [[TabbarViewController alloc]init];    tabbarController.selectedIndex = 4;self.window.rootViewController = tabbarController;    [self.window makeKeyAndVisible];}
The last Wordy

Because it is a rookie, so I hope that we have a lot of advice and common progress! Last attached code address: mollymmm GitHub

iOS Group Address Book effects + side-slip menu (Mmdrawercontroller)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.