This question already has answers here:
Is there a way to adjust the torch/flash brightness level on an iOS device?
(3 answers)
Closed 8 years ago.
I want create simple application such as android app.
Camera properties have only "on" / "off" flash as i known.
Can i change flash brightness? Maybe some libs will help me?
You can from iOS 6.0 on.
Documentation is your friend.
The method you are looking for is setTorchModeOnWithLevel:error:
Also make sure to read the discussion part of method description. Not all devices support setting the torchlevel.
Related
This question already has answers here:
How to get device make and model on iOS?
(23 answers)
Closed 4 years ago.
I am making an sort of similar to dividr in the fact that you have falling objects you must dodge and It works perfectly on the iPhone XR but when I run the simulator for the SE and iphone 7 and other I phones my calculations in my code are messed up, Is there anyway to detect exactly what kind of device they're on? or maybe a better way to go about this to make it universal?
I understand that you can do this
if UIDevice.current.userInterfaceIdiom == .phone
if UIDevice.current.userInterfaceIdiom == .pad
but I'm afraid that isn't specific enough for me
I think the best way to achieve what you are trying to do is by using constraints.
Instead of detecting what device the user is using, you should set proper constraints so that your app can be loaded and played on ANY device.
https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/AutolayoutPG/ProgrammaticallyCreatingConstraints.html
Here is a like on basics.
It is best practice to have an app viewable on many devices and the best way to achieve this is to use constraints. Xcode has 'vary for traits', which allows you to change constraints based on screen width and height!https://www.idev101.com/code/User_Interface/sizes.html
This link above gives a good example on the various screen widths and heights (does not include ipads)
What is 'Vary for Traits' in Xcode 8?
here is a link on vary for traits
I hope this helps
This question already has answers here:
Custom On/Off Image iOS 7.0 UI Switch
(3 answers)
Closed 8 years ago.
I have a UISwitch outlet on my toolbar, and I've set off/on-images in the interface builder, but they don't appear when I run the app.
Is there anything extraordinary you have to do to make these images appear instead of the standard switch-look? I really thought this would be a straight forward process.
Unfortunately, there are no off-on images. You can't customize the look of a UISwitch except for tint colors. The off-on images were withdrawn back in iOS 7.
(So the extraordinary thing you would have to do would be to run on iOS 6!)
This question already has answers here:
How to resize the image programmatically in objective-c in iphone
(10 answers)
Closed 9 years ago.
I created an app of target to iPad and now i want to make an universal app and the time for adjusting my iPad app to iPhone would decrease significantly.
I have set of images (more than 200 images) on iPad dimensions and i want to convert that to iPhone dimension with clarity using objective c (Programmically). I won't need to change iPhone dimension manually, add to Xcode. Because size will increase. if there is an answer for this question.
Thanks.
Kindly look at this other post in stackOverflow
If you want a pixel wise re-sampling refer here and here
hope that helps.
This question already has answers here:
Is there a way of adjusting the screen brightness programmatically?
(3 answers)
Closed 9 years ago.
I want to build an iOs app like f.lux.
It changes the screen brightness of device based on daytime.
I know I have to jailbreak my device. But I don't know how to implement this app.
Please suggest me any useful API to do that.
Thanks in advance.
iOS already has that system-wide feature built-in: see Settings > Brightness & Wallpaper, under Auto-Brightness:
Although it is possible to programmatically control the device's brightness, there is not a public API for determining the outside light, so this is functionality that the OS handles.
Try this (iOS5 and greater only):
[[UIScreen mainScreen] setBrightness:1.0];
From related question: Adjust the brightness of the screen through code
Go through the brightness property of UIScreen which is a new API available after IOS5.
This question already has an answer here:
Closed 10 years ago.
Possible Duplicate:
Retina display VS normal display color difference
My designer has provided me with an iPhone app design using photoshop.
The colours work great on the simulator and iMac monitor.
But as soon as those designs get to the device, everything looks off.
I know/am told this has something to with how the iPhone displays colour.
What I think I have to do is find a colour that works on the device using something like LiveView.
The problem is, the colours are perfect on the iPhone5. But for every other device, they are off. Do I have to pick and choose a colour for each device?
Is this a common problem with colours on the iPhone? Or just some colours?
Any help would be much appreciated. Thanks.
Colors will appear differently on any screen - there are some wonderful tools like XScope that you and your visual designer should be using to preview visual designs on-device while designing in Photoshop.
If your designer is comparing what's on their laptop to what's in your coded app, then they're doing it wrong: they need a way to preview their PSDs on-device as they work. What you see on your iMac won't match what you'll see on-device.
In addition, Panic's made a wonderful color picker tool that you should look at. It plugs into OS X's standard color picker, but gives you the ability to generate UIColor code. You can find the tool here: http://panic.com/~wade/picker/