ios7

Detecting Shake Gesture by CoreMotion

自作多情 提交于 2020-12-06 15:55:06
问题 I want to detect device shake using coreMotion framework for iOS 7. Can anyone help me out how to do this ? I wrote code described below in my viewDidAppear CMMotionManager *motionManager = [[CMMotionManager alloc] init]; motionManager.deviceMotionUpdateInterval = 1.0/60.0; __block double myAcceleration; [motionManager startDeviceMotionUpdatesToQueue:[NSOperationQueue mainQueue] withHandler:^(CMDeviceMotion *motion, NSError *error) { myAcceleration = motion.userAcceleration.y; CATransform3D

NSCache removes all its data when app goes to background State

江枫思渺然 提交于 2020-05-27 05:40:40
问题 I am working with NSCache , I am using NSCache to store images. I am showing images on UITableView . Whenever I add images first they are resized and then added to the table and then to NSCache . eveything works fine. But whenever app goes to background when I close the app and open again, My Cache will be empty and again my app resizes images and then show it, because of which at first I see a empty table. I am not understanding why this is happening. Is this the intended behaviour of

Send localized string key in loc-args for iOS Push notifications

拥有回忆 提交于 2020-05-27 04:06:29
问题 My application supports 4 languages & push notifications. When I send push notification to APNS , I am sending loc_key & loc-args . Now I need to send localized strings in loc-args array so that I can translate those on iOS app side when app receives the push notification. But when I send localized strings in loc-args , instead of showing translated string in notification center , it just showed localized key as it is. My string file contains below 2 messages: "WINNER_ALERT"= "Congratulations

How do you keep the cancel button in the search bar enabled when the keyboard is dismissed?

孤街浪徒 提交于 2020-05-25 03:56:50
问题 I'm trying to achieve the same effect as Apple's Contacts app (left screenshot). The cancel button in UISearchBar is enabled even when the keyboard is dismissed. My app behaves differently (right screenshot). The cancel button automatically becomes disabled when the keyboard is dismissed. The user is forced to tap the cancel button one time to enable it and then another time to actually trigger the dismissal. This is not good user experience. How would I always keep the cancel button enabled

“Renders with edge antialiasing” causes delay in UIAlertView in iOS 7

有些话、适合烂在心里 提交于 2020-05-10 04:16:29
问题 Ever since iOS 7, I noticed my UIAlertViews show with a sort of drawing delay- what happens is the screen dims and the UIAlertView's text appears on the screen for just a split second before the actual frame of the alert view appears. I traced the problem to being due to the "Renders with edge antialiasing" flag set to YES in my application plist file. Turning this off solves the problem (but then I have ugly jaggies on any rotated views, which is what I was using that flag to solve in the

How to hide statusbar icons in iOS

微笑、不失礼 提交于 2020-02-24 11:21:10
问题 I want to create a simple mobilesubstrate tweak that hides and shows status bar icons like battery or Carrier or wifi signal indecator. I've seen libstatusbar project but i can't find out how to hide iOS's icons. Is there any other way to do this without the use of this library? I just want to hide and show the default icons 回答1: Here is what I use in my tweak: int itemToHide = 0; [[objc_getClass("SBStatusBarStateAggregator") sharedInstance] beginCoalescentBlock]; [[objc_getClass(

replace layout manager of uitextview

时光毁灭记忆、已成空白 提交于 2020-02-15 08:23:12
问题 NSTextContainer on Mac OS X has a method replaceLayoutManager: to replace the NSLayoutManager of NSTextView with a subclass of NSLayoutManager. Unfortunately iOS doesn't have such a function. I tried a combination of these lines of code, but it keeps crashing. THLayoutManager *layoutManager = [[THLayoutManager alloc] init]; [layoutManager addTextContainer:[self textContainer]]; // [[self textStorage] removeLayoutManager:[self layoutManager]]; //[[self textStorage] addLayoutManager

google map sdk ios 7 mylocationbutton disappear

蹲街弑〆低调 提交于 2020-02-06 02:58:14
问题 i'm using my google map ios sdk in my ios app and i set mylocationbutton = yes ; here is the complete code GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86 longitude:151.20 zoom:6]; mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera]; mapView_.myLocationEnabled = YES; self.view = mapView_; mapView_.delegate = self; mapView_.settings.myLocationButton = YES; mapView_.settings.compassButton = YES; it is running well in ios 6 or earlier level which the button