Tag: ibaction

使用IBActionbutton缩放MapView

我有一个问题。 我的当前位置显示并居中在地图视图中,但地图区域不会放大。 我试图通过采取跨越和区域的didUpdateToLocation方法采取罗布的build议,但我不能实现它的权利。 我不认为这是识别我的调用setDialDialLoad和我的button不被识别。 请检查我的代码,并指出错误。 我的目标是能够使用IBActionbutton放大和缩小我的位置。 。H – (IBAction)zoomIn:(id)sender; – (IBAction)zoomOut:(id)sender; 在viewDidLoad中 double miles = 0.5; MKCoordinateSpan span; span.latitudeDelta = miles/69.0; span.longitudeDelta = miles/69.0; MKCoordinateRegion region; region.span = span; [self.mapView setRegion:region animated:YES]; [self.mapView setUserTrackingMode:MKUserTrackingModeFollow animated:YES]; _mapView.mapType = MKMapTypeSatellite; .m在我didUpdateToLocation方法。 [self.mapView setCenterCoordinate:newLocation.coordinate animated:YES]; 。放大: – (IBAction)zoomIn:(id)sender { MKCoordinateSpan span; span.latitudeDelta = _mapView.region.span.latitudeDelta * 2; span.longitudeDelta = […]

将.xib中的对象连接到现有的IBAction

我对iOS编程颇为陌生。 这是我的问题: 我想连接一个新的对象到现有的IBAction方法。 例如,我想要button来执行相同的function。 但是当我“控制”拖动它的时候,它会一直要求我插入一个新的方法。 我如何添加到现有的而不是创build一个新的? XCode中的快照

如何定义哪个button被按下,如果他们都有相同的IBAction?

我有两个UIButtons(我创build它们使用IB),它连接到文件的所有者与相同的IBAction,我怎样才能定义他们被按下?

从代码中调用IBAction的最佳方式是什么?

说例如我有一个IBAction是连接到一个UIButton在界面生成器。 – (IBAction)functionToBeCalled:(id)sender { // do something here } 在我的代码中,例如用另一种方法说,调用这个IBAction的最好方法是什么? 如果我尝试像这样调用它,我收到一个错误: [self functionToBeCalled:]; 但是,如果我尝试像这样调用它(我认为有一点欺骗),它可以正常工作: [self functionToBeCalled:0]; 什么是适当的方式来正确调用它?

如何从UICollectionViewCell访问UICollectionView中Cell的indexPath

我想animationUICollectionViewCell行动时被调用。 我在Interface Builder UICollectionView也做了UICollectionView 。 现在我想在我的actionBtnAddToCard方法得到正确的indexPath 。 这就是我现在尝试的方式(ProduktViewCell.m中的方法): – (IBAction)actionAddToCart:(id)sender { XLog(@""); // see this line NSIndexPath *indexPath = ??** how can i access the correct indexPath**??; SortimentViewController *svc = [[SortimentViewController alloc] initWithNibName:@"SortimentViewController_iPad" bundle:[NSBundle mainBundle]]; [svc.collectionViewProdukte cellForItemAtIndexPath:indexPath]; [svc collectionView:svc.collectionViewProdukte didSelectItemAtIndexPath:indexPath]; } SortimentViewController是inheritanceUICollectionView的viewController。 如何访问正确的indexPath? 更新1:编辑后更好的理解。

将不同的parameter passing给IBAction

我的iPhone应用程序有很多button,我希望所有的button调用相同的方法,但具有不同的参数。 例如我想点击一个button调用方法myMethod:使用参数@"foo" ,第二个button应调用相同的方法,但使用参数@"bar" 。