Tag: 目标C

CABasicAnimation完成1个周期后回到原来的位置

在下一个animation和Objective-C 之前不要将CABasicAnimation返回到原始位置 – animation之后应用更改的CABasicAnimation? 和CABasicAnimation旋转返回到我试过的原始位置 。 below code does,bottom->top->goes left->back to it's original position. bottom->top->goes left->back to its original position. I need bottom->top->goes left.bottom->top->goes left so on… -(void)addUpDownAnimationForButton:(UILabel*)label { CABasicAnimation * bottomAnimation ; bottomAnimation =[CABasicAnimation animationWithKeyPath:@"transform.translation.y"]; [bottomAnimation setValue:@"animation1" forKey:@"id"]; bottomAnimation.delegate = self; [UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:)]; bottomAnimation.duration = 2.0; bottomAnimation.fromValue = [NSNumber numberWithFloat:13]; bottomAnimation.toValue = [NSNumber numberWithFloat:-7]; […]

故障位是否会影响cin上的调用?

设置失败位后:当我第一次调用cin.clear(),然后cin.ignore()时,程序是正确的。 当我第一次调用cin.ignore()然后cin.clear()时,忽略似乎不起作用,为什么?

推送通知:didFailToRegister和didRegister委托没有调用

我正在创build一个支持推送通知的应用程序 我正在遵循所有的步骤。 它给模拟器上的错误 Failed to get token, error: Error Domain=NSCocoaErrorDomain Code=3010 "remote notifications are not supported in the simulator" UserInfo=0x5813d20 {NSLocalizedDescription=remote notifications are not supported in the simulator} 但在设备上它不会调用委托方法 didFailToRegisterForRemoteNotificationsWithError didRegisterForRemoteNotificationsWithDeviceToken 我的代码: – (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)]; NSLog(@"application didFinishLaunchingWithOptions"); // Override point for customization after application launch. […]

通知不会导致dealloc被调用

我想在一个项目中使用这个: https : //github.com/zakkhoyt/VWWPermissionKit 我不太了解KVO /通知中心,所以我想发表一个问题。 基本上,Permission Manager的init和dealloc如下所示: – (instancetype)init { self = [super init]; if (self) { [[NSNotificationCenter defaultCenter] addObserverForName:VWWPermissionNotificationsPromptAction object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) { dispatch_async(dispatch_get_main_queue(), ^{ VWWPermission *permission = note.userInfo[VWWPermissionNotificationsPermissionKey]; [permission presentSystemPromtWithCompletionBlock:^{ dispatch_async(dispatch_get_main_queue(), ^{ [permission updatePermissionStatus]; if(permission.status == VWWPermissionStatusDenied){ [self.permissionsViewController displayDeniedAlertForPermission:permission]; } [self checkAllPermissionsSatisfied]; }); }]; }); }]; [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidBecomeActiveNotification object:nil […]

滚动后,自定义TableView单元格中的标签消失

我有dynamictableView与自定义单元格。 CustomCell .h文件看起来像这样: @property (strong, nonatomic) IBOutlet UILabel *uslugaName; //I set retain doesn't work too @property (strong, nonatomic) IBOutlet UILabel *howMuchPayLbl; 我的CellForRowAtIndexPathMethod: -(UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString * cellIdentifier = @"Cell"; myCustomCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; /* if (!cell) cell = [[myCustomCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier]; */ if (indexPath.row !=15) { cell.uslugaName.text […]

Sqlite查询,比较date时间字段与当前的date时间

在我的iPhone应用程序,我想查询过去的logging。 有一个名为“task_dateTime”的date时间字段。 如果使用,从任务中selecttask_dateTime; 结果看起来像这样,2012年4月26日16:32 2012年4月27日16:38 2012年4月29日05:32 我如何查询以前的logging。 这意味着我想用当前时间与“task_dateTime”字段进行比较。

在Xcode 9的iPhone模拟器中截图

在XCode 9.0中如何从iPhone 8 Plus模拟器截取尺寸为1242 x 2208(App Store所需)的截图? 我不能像在早期版本的XCode中那样调整模拟器的大小。 有没有办法做到这一点?

是否有任何工作algorithm来计算所有iOS设备(有或没有M7芯片)的步骤?

我想做一个应用程序。 那个用户步数。 所以,我已经通过谷歌search,但没有发现任何可以真正帮助我。 虽然我知道通过使用加速度计数据我们可以得到步骤,我尝试了这个代码 -(void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration { const float violence = 1.2; static BOOL beenhere; BOOL shake = FALSE; if (beenhere) return; beenhere = TRUE; if (acceleration.x > violence || acceleration.x < (-1* violence)) shake = TRUE; if (acceleration.y > violence || acceleration.y < (-1* violence)) shake = TRUE; if (acceleration.z > violence […]

Xcode找不到cstddef

Xcode(iOS)不能由于某种原因find我使用的库(Boost)的cstddef。 有谁知道如何解决这一问题? 我正在用Xcode 4.6编译Mac OS X 10.8

使用openGL和cocos2D绘制大量线条的最好方法是什么?

我有一系列的2d顶点表示用于绘制网格的线条。 有大约900个线段绘制(网格使用弹簧物理来扭曲,这就是为什么我不只是为每行和每列绘制一条线)。 cocos2D内置了一个ccDrawLine函数,可以很好地绘制,但是我认为这可能是低效的,因为它为每个线段调用glDrawArrays。 你如何有效地绘制大量的线段? 作为奖励,请使用openGL推荐良好的2D绘图实践。