나는 정의 셀에는 다음과 같은 구성 요소가있는 스토리 보드와 함께 내장되어 :맞춤형 셀의 버튼을 사용 중지하는 방법은 무엇인가요?
하나있는 UIImage 2 UILabels 4 UIbuttons
하나 개의 버튼을 사용자가 즐겨 찾기로 쿠폰을 저장할 수 있습니다
을,이 버튼을 설정하려는 사용자가 쿠폰을 저장 한 후 사용하지 않도록 설정했는데 맞춤 셀 클래스의 버튼에 IBOutlet을 추가하려고했지만 작동하지 않아 오류가 발생하지 않습니다. 어떻게해야합니까? 누군가 나를 도울 수 있니?강령 :
CouponsCell.h
@property (nonatomic, strong) IBOutlet UIButton *saveFav;
나는 때 함께 IBOutlet과 버튼 사이의 연결을 만든
#import "CouponsCell.h"
@implementation CouponsCell
@synthesize saveFav;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code
}
return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
CouponsCell.m 사용자 터치 버튼을 시도해 봤어 S :
- (IBAction)AddFavorite:(id)sender {
CGPoint buttonPosition = [sender convertPoint:CGPointZero toView:self.tableView];
NSIndexPath * indexPath = [self.tableView indexPathForRowAtPoint:buttonPosition];
Coupons * couponsObjects = [self.fetchedResultsController objectAtIndexPath:indexPath];
CouponsCell *couponsCell = [self.tableView dequeueReusableCellWithIdentifier:@"CouponCell" forIndexPath:indexPath];
idCoupon = cuponesObjects.idCoupons;
Reachability *reachability = [Reachability reachabilityForInternetConnection];
[reachability startNotifier];
NetworkStatus status = [reachability currentReachabilityStatus];
if (status == NotReachable)
{
UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"CC Galerias"
message:@"Can’t save the Coupon to favorite, Check your Internet connection."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[message performSelectorOnMainThread:@selector(show) withObject:nil waitUntilDone:YES];
}
else if (status == ReachableViaWiFi)
{
[self postCouponFav:idCoupon]; // Save the Coupon to Favorites
[couponsCell.saveFav setEnabled:NO]; // Set diseable the button
}
else if (status == ReachableViaWWAN)
{
[self postCouponFav:idCoupon];
[couponsCell.saveFav setEnabled:NO];
}
}
이 제발 도와주세요, 어쩌면 솔루션은 간단하지만 아이폰 OS 개발을 학습. 도와 주셔서 미리 감사드립니다.
혼합 된 경우 (NO 고함)를 사용하고 적절한 제목을 변경하려면 제목을 변경하시기 바랍니다 귀하의 질문을 반영합니다. – rmaddy
AddFavorite 메서드에 중단 점을 배치하면 실행이 중지됩니까? – tdelepine
미안 해요 내가 stackoverflow에 새로운 오전, 나는 이미 제목을 변경 ... – Joe0588