這裏運行的UIButton的功能是我的代碼:我怎麼可以不點擊按鈕
-(void)btnSelectItem:(id)sender{
NSString *userId =[[NSUserDefaults standardUserDefaults] valueForKey:USER_ID_KEY];
[sender setBackgroundImage:[UIImage imageNamed:@"radio_selected"] forState:UIControlStateNormal];
int i = (int)[sender tag];
//[CollectionViewSize performBatchUpdates:^{ [CollectionViewSize reloadItemsAtIndexPaths:@[[NSIndexPath indexPathForRow:i inSection:0]]]; } completion:nil];
// [CollectionViewSize reloadItemsAtIndexPaths:@[[NSIndexPath indexPathForRow:i section:0]]];
strMenuID = [NSString stringWithFormat:@"%@",[[arayResponce objectAtIndex:i]valueForKey:@"menu_id"]];
lblItemCount.text = [NSString stringWithFormat:@"%@",[[arayResponce objectAtIndex:i]valueForKey:@"price"]];
[adCartParam removeAllObjects];
adCartParam = [NSMutableDictionary dictionary];
[adCartParam setObject:[NSNumber numberWithInt:kresto_id] forKey:@"resto_id"];
[adCartParam setObject:strMenuID forKey:@"menu_id"];
[adCartParam setObject:userId forKey:@"cust_id"];
[adCartParam setObject:[AppDelegate getDelegate].subCategoryID forKey:@"cat_id"];
NSString *price = [CommonClass stringByReplacing:lblItemCount.text and:@"$" withString:@""];
///[lblItemCount.text stringByReplacingOccurrencesOfString:@"$"
// withString:@""];
[adCartParam setObject:price forKey:@"price"];
[adCartParam setObject:@1 forKey:@"qty"];
[adCartParam setObject:[[arayResponce objectAtIndex:i]valueForKey:@"size_id"] forKey:@"size_id"];
}
你可以用'[button sendActionsForControlEvents:UIControlEventTouchUpInside];' –
在viewdidload中調用這個btnSelectItem方法。 –