- (void)temperatureListWithCompletion:(void(^)(NSError * error, NSArray *results)); И вызывать его уже откуда душа пожелает. Не стоит, правда, забывать о том, что нет смысла посылать новый запрос, пока не пришел ответ на предыдущий точно такой же. objectManager = [[RKObjectManager alloc] initWithHTTPClient:afHttpClient];RKResponseDescriptor *characterResponseDescriptor =
[RKResponseDescriptor responseDescriptorWithMapping:objectMapping
method:RKRequestMethodGET
pathPattern:pathPattern
keyPath:@"data.results" // <- путь к JSON-массиву
statusCodes:[NSIndexSet indexSetWithIndex:200]];
[objectManager addResponseDescriptor:characterResponseDescriptor];[objectManager getObjectsAtPath:path
parameters:queryParams
success:success
failure:failure]; - (void)viewDidLoad {
[super viewDidLoad];
ImageTouched *instance = [[ImageTouched alloc] initWithFrame:CGRectMake(0, 0, 50, 50)];
[self.view addSubview:instance];
// Подписываемся на уведомление
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(imageDidTouch:) name:@"ImageTouchedImageDidTouch" object:nil];
}// Метод, который обрабатывает уведомление
- (void)imageDidTouch:(NSNotification *)notification {
if ([notification.object isKindOfClass:[ImageTouched Class]])
NSLog(@"Pew value is %@", ((ImageTouched *)notification.object).pew);
}-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
NSLog(@"Image Touched");
self.pew = @"pewpewpewew";
// Отправить уведомление, отправляя самого себя в качестве параметра object
[[NSNotificationCenter defaultCenter] postNotificationName:@"ImageTouchedImageDidTouch" object:self];
}NSInteger chisloValue = [chislo.text integerValue];
if (number == chisloValue)
... - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
[super touchesEnded:touches withEvent:event];
if (_editingMode) {
// Do my thing
}
}GDCollectionViewCell *cell = [collectionView cellForItemAtIndexPath:indexPath];
if (cell.editingMode)
return; // Do nothing in editing mode