Using a UIImage as the application icon - cocoa-touch

Is possible to set an image as an iPhone application unique icon in code instead of adding a PNG format image file and naming it Icon.png?

a) No, not for developer applications. Also note that Apple's preload applications can demonstrably alter Default.png (see the Notes app) but that can't be done by the rest of us.
b) The app icon can also be a jpeg and can be called whatever you like - you just need to set it appropriately in Info.plist

Here is an example of what you would add to your Info.plist:
<key>CFBundleIconFile</key>
<string>app.png</string>
This (as well as other related options) is well documented in the iPhone Application Programming Guide.
Note: you may need an Apple Developer account to see that link.

Related

adding keys to info.plist in Xcode

And yet, another glaring hole in my knowledge about developing things pops up..
But, after some internetz, I find that in order to make geolocation work in react native apps, I need to:
You need to include the NSLocationWhenInUseUsageDescription key in Info.plist to enable geolocation when using the app.
that makes sense, this is the bit that makes the native tools talk to the js framework (I think).. but how do I add a value to that plist file? What does that key look like?
After pressing on the plus button marked in red circle search for
=> Privacy - Location When In Use Usage Description ... Then you will have to add a description right beside it
This should be your result
PS make sure you open info.plist as property list to implement the way i'm showing.
Hope this helps !

How to add NSPhotoLibraryUsageDescription, NSCameraUsageDescription, and NSMicrophoneUsageDescription to info.plist for react-native-image-picker

I'm new to xcode and react-native. I'm trying to use react-native-image-picker to add a user profile (uploaded to s3). react-native-image-picker's getting started assumes you have knowledge of info.plist. I'm not 100% sure how to proceed given:
For iOS 10+, Add the NSPhotoLibraryUsageDescription,
NSCameraUsageDescription, and NSMicrophoneUsageDescription (if
allowing video) keys to your Info.plist with strings describing why
your app needs these permissions
I know the info.plists are found in the ios folder, but
which info.plist do these permissions need to get added to (there's multiple inside ios folder: build, RNapp, RNapp-tvOS, RNapp.xcodeproj, etc)?
how does the XML look?
Should this be happening in xcode instead of my text editor?
docs
if you don't providing the privacy key in Info.plist, then your app is crash. You can see its log why crashed.
You will find these code below in the info.plist of your xcode , open in text editor.
adding these will grant the permission for using camera, PhotoLibrary, Video
<key>NSCameraUsageDescription</key>
<string>${PRODUCT_NAME} Camera Usage</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>${PRODUCT_NAME} PhotoLibrary Usage</string>
<key>NSVideoSubscriberAccountUsageDescription</key>
<string>${PRODUCT_NAME} Video Subscribe Usage</string>
add ti info.plist
<key>NSPhotoLibraryUsageDescription</key>
<string>Photo Library Access Warning</string>
You want to edit the plist that you need the permissions for. If you are making a mobile app that would be: RNapp.
You could do this in a text editor but the easiest way to do it is in Xcode.
Open the plist, on the last item (making sure it is not expanded_ hit the + button to create a new row to provide a key to define a value for. Xcode should autocomplete on the keys you provided above and set the value to the appropriate type.
Hope this helps.

Library or API for file browser view?

I would like to implement a file browser view in my application so users can open files using a side panel similar to the browsers in XCode, Text Wrangler and some other programs.
Before I go off implementing another one of those browsers from scratch, does anyone know if there are existing libraries or APIs that already does this?
Google doesn't turn up with much and most of the searches point me to NSOpenPanel which I believe doesn't do what I want.
Thanks in advance.
The Cocoa class that is used to display hierarchical lists is called NSOutlineView.
Outline views provide several configuration options to adjust the appearance.
The content can be provided by implementing a data source protocol or via Cocoa bindings.
Apple has some sample code online that should get you started (it's a file browser - so maybe you can use larger parts of that sample):
https://developer.apple.com/library/mac/#samplecode/SourceView/Introduction/Intro.html

How do I create an in-app settings view?

I want to create an in-app setting view like the following image:
What are these fields called? and what is the best way to create settings?
I found many tutorial but all of them are referring to creating the settings page in the phone settings, using the setting bundle and what I want is creating settings page in the app itself.
Both http://www.inappsettingskit.com and http://inscopeapps.com/#inappsettings both use the standard Settings.app bundle. So you have the ability to set defaults in your app AND in the standard Settings.app. They're simple enough to add your project and work pretty well.
If you only want the settings to be in the app, then your screen shot simply shows a standard UINavigationController with UITableViews. You can create something like this in the standard ways using Interface Builder or programatically, and then respond to any changed settings by saving NSUserDefaults objects/integers/booleans/URLs.
Whichever method you choose, add an observer for NSUserDefaultsDidChangeNotification in any views that need to respond instantly to the change (you can simply read the current value of the NSUserDefaults objects/integers/booleans/URLs in real time if you don't need something to respond instantly).
Try using In App Settings Kit.
Can be found here: http://www.inappsettingskit.com

Quicklook embedded preview

From the docs for quicklook:
"The consumer portion of Quick Look
has three components: a document
reader (consisting of a custom view
and panel), display bundles for that
reader, and an SPI to enable
communication with the client. Each of
these components has a specific role
to play in support of the consumer:
Document reader—Quick Look implements
a view (NSView) and panel (NSPanel)
customized for displaying document
previews. Along with the preview
content, the view might include (at
the client’s option) controls for
manipulating the preview, such as
page-forward, page-backward, start
playing, rewind, and text-search. A
client application can embed this view
in its user interface if it chooses.
The Quick Look panel contains a Quick
Look view and various controls that
let the user take some action with the
preview, such making the preview image
full-screen or starting a slideshow."
I have been poring through all the docs and examples for quicklook and I don't see either:
A definition of any sort of "Document reader" component or way to access it.
Any sort of SPI as such that would show how to consumer quicklook
Any direct access to the NSView used by quicklook to display previews.
All I want to to do as the docs say: embed quicklook's view in my own hierarchy rather than in the Panel. The panel of course has abundant documentation. Has anyone successfully used Quicklook in this manner before?
The class you are looking for is QLPreviewView, part of Quartz.framework. It's a public class (introduced in Lion, I believe). Unfortunately, the docs team apparently hasn't yet released its documentation, which is probably why you couldn't find it. The official docs are now available.
The short, short version is that you create it the way you would any other view, and set its previewItem to an id <QLPreviewItem> that you supply. The <QLPreviewItem> protocol is documented. E.g.
QLPreviewView *pv = [[QLPreviewView alloc] initWithFrame:frame
style:QLPreviewViewStyleNormal];
[pv setPreviewItem:item];
[myView addSubview:pv];
[pv release];
That's the basic concept, YMMV.
Its operation is thoroughly covered in the 2011 WWDC session "System-wide Previews on Mac OS X and iOS" (or something to that effect). You should be able to get the video if you are a paid member of either the Mac OS X or iOS developer programs.