iphone-4

Cannot change cameraFlashMode for UIImagePickerController iphone 4 custom cameraOverlayView

纵饮孤独 提交于 2019-12-05 20:36:49
Question : Why imagePickerController.cameraFlashMode always returns 0 on iphone 4 and returns correct values with iphone 5 ? I init my UIImagePickerController and set the cameraFlashMode to UIImagePickerControllerCameraFlashModeOn: imagePickerController = [[UIImagePickerController alloc] init]; imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera; imagePickerController.mediaTypes = [NSArray arrayWithObject:@"public.image"]; imagePickerController.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto; imagePickerController.showsCameraControls = NO;

CoreGraphics slower on iPhone4 than on 3G/3GS

时光怂恿深爱的人放手 提交于 2019-12-05 02:52:59
问题 I have a chart drawn with CoreGraphics. This chart can be scrolled horizontally and it's drawn as we scroll it. The problem is that on 3G/3GS the speed and performance of the scroll is good but on iPhone 4 is slower than expected. I suppose this is a issue related to the higher resolution of the iPhone 4. Is that correct? How can I increase the performance on iPhone 4? Does the framework automatic conversion to draw on iPhone 4 resolution or is it my work? Thank you very much. 回答1: The iPhone

iPhone4 iOS5 battery level monitoring do I need to add setBatteryMonitoringEnabled:NO to periodic battery checks?

强颜欢笑 提交于 2019-12-05 02:42:34
问题 I'm running an app that samples accelerometer and gyroscope data overnight. This is a very battery intensive operation, and I would like to teach my app to recognize when the battery is getting low. Here's my prototype code, which checks the battery level every 10 minutes NSDate* date = [NSDate date]; if((int)([date timeIntervalSinceReferenceDate])%600 == 0) { UIDevice *myDevice = [UIDevice currentDevice]; [myDevice setBatteryMonitoringEnabled:YES]; float batLeft = [myDevice batteryLevel];

iPhone 4 ignoring viewport meta tag

纵饮孤独 提交于 2019-12-04 20:17:25
I have just added the following HTML to the <head> section of my iPhone web app: <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=no;"/> This (supposedly) limits the zoom of the page so the user can't zoom in. On iOS versions prior to 4.0, this tag is respected - but iOS versions 4.0+ completely ignore it, and lets you zoom in all you want. Furthermore, if you rotate, iPhone 4 will weirdly zoom in automatically. So what I'm asking is, How can I "lock" the zoom for my app? Can anyone point me in the right direction? If you have Zoom enabled

iPhone 4 web-app browser width: 960 or 981?

元气小坏坏 提交于 2019-12-04 14:51:42
<html> <body REMonload="document.location.assign('index2.php?w=' + window.innerWidth + '&h=' + window.innerHeight);"> <script language="javascript"> document.write('w=' + window.innerWidth + '&h=' + window.innerHeight); </script> </body> </html> Output: w=981&h=425 Why? Wikipedia says, w should be 960. Regards, UPDATE I've found out, the problem was related to viewport meta tag. The following code does what I want to see: <html style="width:100%; height:100%;"> <head> <meta name="viewport" content="width=device-width; initial-scale=0.5; minimum-scale=0.5; maximum-scale=0.5; user-scalable=no;"

CGContext text drawing doesn't scale up on iPhone 4

▼魔方 西西 提交于 2019-12-03 17:39:19
问题 I am trying to create an app that scales up nicely on the iPhone 4. Currently most of it scales up perfectly, except for one crucial piece: the text that I draw inside a CALayer, inside its drawInContext: method. Here is my code: - (void)drawInContext:(CGContextRef)context { UIGraphicsPushContext(context); CGContextSetGrayFillColor(context, 1.0f, 1.0f); CGContextFillRect(context, self.bounds); CGContextSetAllowsAntialiasing(context, true); CGContextSetShouldAntialias(context, true);

CGContext text drawing doesn't scale up on iPhone 4

ⅰ亾dé卋堺 提交于 2019-12-03 07:33:22
I am trying to create an app that scales up nicely on the iPhone 4. Currently most of it scales up perfectly, except for one crucial piece: the text that I draw inside a CALayer, inside its drawInContext: method. Here is my code: - (void)drawInContext:(CGContextRef)context { UIGraphicsPushContext(context); CGContextSetGrayFillColor(context, 1.0f, 1.0f); CGContextFillRect(context, self.bounds); CGContextSetAllowsAntialiasing(context, true); CGContextSetShouldAntialias(context, true); CGContextSetAllowsFontSmoothing(context, true); CGContextSetShouldSmoothFonts(context, true);

Scalar type in Managed Object only works for IPhone 5

馋奶兔 提交于 2019-12-03 00:32:20
Property 'Latitude' is a scalar type on class 'LatitudeLongitude'. Cannot generate a setter method for it. When I generated codes for my managed object, I got a message whether I want scalar properties for primitive data type. should I use it? I want to make this application compatible with iPhone 3 - 5 is there any issues with this problem? When you use scalar properties you have to provide implementations of getters and setters for those properties by yourself, as described in documentation: "You can declare properties as scalar values, but for scalar values Core Data cannot dynamically

Enabling the photo library button on the UIImagePickerController

筅森魡賤 提交于 2019-12-02 20:38:17
Does anyone know how to enable the photo album button on the UIImagePickerController when its in the camera mode? Like how the camera app on on the iphone can toggle between image and video taking and also has the button to view the photo library? I'm afraid that this can't be done in that easy way (just enable or disable some magic feature). For some simple requirement, you can use cameraOverlayView and showsCameraControls to make the implementation. If you want to switch between photo/video mode, i think you can check this demo: http://developer.apple.com/library/ios/#samplecode/AVCam

colorWithPatternImage creates black grids in iphone 4

被刻印的时光 ゝ 提交于 2019-12-01 10:59:50
问题 I have UIView *topPart = [[UIView alloc] initWithFrame:CGRectMake(9, 0, 302, 318)]; topPart.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"pattern.png"]]; [someScroller addSubview:topPart]; [topPart release]; and I can see the pattern fine when I use a 3gs or the iphone simulator, but when I tested on an actual iPhone 4, I see the pattern images but there are black lines separating each pattern so it looks like a grid. I checked the pattern image and there is no black