8. Roster

Source: Internet
Author: User

Open the Roster header file

XMPPRoster.h

XMPPRosterCoreDataStorage.h Core Data storage

Defining Xmpproster global access for the Roster attribute module in AppDelegate.h

Defining the Xmpprostercoredatastorage data storage module in APPDELEGATE.M

To set up the roster and activate it under the Electronic Business Card module in the setup Xmppstream

2.3 _xmpprosterstorage = [[Xmpprostercoredatastorage alloc] init];

_xmpproster = [[Xmpproster alloc] initwithrosterstorage:_xmpprosterstorage];

    

3. Re-connect the module to Xmppstream

[_xmpproster Activate:_xmppstream];

4. Add an Agent

[_xmpproster adddelegate:self Delegatequeue:dispatch_get_global_queue (dispatch_queue_priority_default,0)];

Destroy Xmppstream and log out

{

1. Remove the agent

[_xmpproster removedelegate:self];

2. Deactivate

[_xmpproster deactivate];

4. Memory cleanup

_xmpproster = nil;

_xmpprosterstorage = nil;

}

To create a class, Rosterviewcontroller inherits Uitableviewcontroller to point the class of the roster to the classes to specify a reusable identifier identifier: Rostercell 

Use XMPP Roster storage to import a coredata.framework framework

Using the Nsfetchedresultscontroller crawl result controller

Import <CoreData/CoreData.h> header files in. m files

and define a member variable Nsfetchedresultscontroller *_fetchedresultscontroller;

Number of table groupings

-(Nsinteger) Numberofsectionsintableview: (UITableView *) TableView;

{

return _fetchedresultscontroller.sections.cont; Returns the number of query results

}

Number of rows in a table in the corresponding group

-(Nsinteger) TableView: (UITableView *) TableView numberofrowsinsection: (Nsinteger) section{

Nsarray *sectiondata = [_fetchedresultscontroller sections];

if (sectiondata.count>0) {

ID <nsfetchedresultssectioninfo>sectioninfo = sectiondata[section];

return [Sectioninfo numberofobjects];

}

return 0;

}

Table Row Contents

-(UITableViewCell *) TableView: (UITableView *) TableView Cellforrowatindexpath: (Nsindexpath *) indexpath{

static NSString *id = @ "Rostercell"; ID is a table reusable identifier

UITableViewCell *cell = [TableView dequeuereusablecellwithidentifier:id Forindexpath:indexpath];

return cell;

Set cells

}

Instantiate Nsfetchedresultscontroller

-(void) setupfetchedcontroller{

0. If you want to do data access for CoreData, you can not do without nsmanagedobjectcontext

1. Instantiating Nsmanagedobjectcontext

2. Instantiating Nsfetchedresultscontroller

  

  

3. Querying data

  

}

  

  

8. Roster

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.