Well, you got a down vote (not from me :)) for a reason - this is pretty basic stuff and you get lot of information around with just 2 minutes serious online surfing :)!
I would try to give you a direction here because you want to implement "Show More" feature:
Step 1 : You need to build a service which takes the batchNumber
and feeds you data belonging to that batch. So, initially you would send batchNumber = 0
and server returns you first 40 records.
Step 2 : On UI side, return 1 count more than the count of data records you have in hand to show. That additional count is for the last cell Show More.
Step 3 : On tap on Show More, increase your current batchNumber
by 1 and make the server call to get the next batch records.
Step 4 : Continue step 2 & 3 util all records are loaded.
Finally, this is how you load server data using a post request:
NSError *error;
NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
NSURLSession *session = [NSURLSession sessionWithConfiguration:configuration delegate:self delegateQueue:nil];
NSURL *url = [NSURL URLWithString:@"[JSON SERVER"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:60.0];
[request addValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request addValue:@"application/json" forHTTPHeaderField:@"Accept"];
[request setHTTPMethod:@"POST"];
NSDictionary *mapData = [[NSDictionary alloc] initWithObjectsAndKeys: @"TEST IOS", @"name",
@"IOS TYPE", @"typemap",
nil];
NSData *postData = [NSJSONSerialization dataWithJSONObject:mapData options:0 error:&error];
[request setHTTPBody:postData];
NSURLSessionDataTask *postDataTask = [session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
}];
[postDataTask resume];
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…