1
-(void)gettop10button
{   
    NSURL *url=[NSURL URLWithString:@"http://appabn.com/iphone/files/api/api.php?q=helo_users&u_id=5&page=1"];  // web api link

    NSURLRequest *request=[NSURLRequest requestWithURL:url];
    connection=[NSURLConnection connectionWithRequest:request delegate:self];

在链接的最后一个我们看到 page=1 ,我有超过 10 个页面。那么我如何传递变量/参数/参数,所以我可以增加页码。提前致谢 'int page; page++;

can perform like as .

在链接的最后一个我们看到 page=1 ,我有超过 10 个页面。那么我如何传递变量/参数/参数,所以我可以增加页码。提前致谢 'int page; page++;

可以像 .

if(connection)
{
    webData=[[NSMutableData alloc]init];
}   
[JustConfesstable reloadData];
4

1 回答 1

1

就是这么简单。我仍然很惊讶您没有得到代码的哪一部分。您只需要获取一个pageNo类型的变量(例如),int然后为其提供默认值1。您只需增加pageNo(using pageNo++) 以获取下一页值,然后您必须为 URL 创建字符串,然后使用名为classpageNo的方法将其简单地传递给 URL 。URLWithStringNSURL


使用 Objective-C 以 4 个简单的步骤翻译上述所有描述:

NSString *urlString = [NSString stringWithFormat:@"http://appabn.com/iphone/files/api/api.php?q=helo_users&u_id=5&page=%d",pageNo];
NSURL *url = [NSURL URLWithString:urlString];  // web api link
NSURLRequest *request = [NSURLRequest requestWithURL:url];
connection = [NSURLConnection connectionWithRequest:request delegate:self];
于 2013-09-11T07:59:21.000 回答