0
버튼과 웹 서비스에 대해 알고 싶습니다. 일반적으로 indexPath.item
으로 웹 서비스의 데이터를 보여주기 위해 Uicollectionview
을 사용하지만, 사용하지 않으면 Uicollectionview
가능합니까? 웹 서비스에서 데이터를 전달하고 가져올 수 있습니다.웹 서비스 데이터를 버튼으로 확인하는 방법은 무엇입니까?
여기에 어떤 아이디어에 대해 조언을 주시기 바랍니다 코드
-(IBAction)ttButton:(id)sender
{
bookName = @"test";
bookVersion = [[bookList objectAtIndex:indexPath.row]bookVersion];// when I use this it's will crash.
_bookPosition = [[bookList objectAtIndex:indexPath.row]bookPosition];
bookId = @"1";
bookPath = @"test001";
pageAmount = 2;
mainMenu = @"test";
// downloadURL = [[bookList objectAtIndex:indexPath.row]downloadURL];
// pageAmount = [[bookList objectAtIndex:indexPath.row]pageAmount]; I want to go like this. but indexPath I can use only in collection view
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSString *stringURL = [NSString stringWithFormat:@"http://tlf/testdata/webservice/book_extract.php?main_menu=test&language=en&id=%@",(_bookPosition)];
NSURLResponse *response = nil;
NSError *error = nil;
NSURL *url = [NSURL URLWithString:stringURL];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
NSURLConnection *urlConnection = [[NSURLConnection alloc]init];
NSData *data = [NSURLConnection sendSynchronousRequest:urlRequest returningResponse:&response error:&error];
dispatch_async(dispatch_get_main_queue(), ^{
[self connection:urlConnection didReceiveResponse:response];
[self connection:urlConnection didReceiveData:data];
[db saveAssetVersion:_assetVersion];
if([db isDownloaded:bookId bookVersion:[bookVersion floatValue]]){
[self performSegueWithIdentifier:@"test" sender:self];
}
else{
[self startDownload];
}
});
});
}
입니다. 고맙습니다.
흠, 고맙습니다. 저는 Uicollectionview를 설정하는 것이 잘못되었습니다. –