How to use Webview's Identifier which's set in IB's Attribute inspector?
Here is a screenshot from the attribute insp开发者_如何学Cector:
The identifier field in Interface Builder is equivalent to -[WebView setPreferencesIdentifier:]
. This identifier is stored in the defaults database and refers to a set of preferences that can be shared amongst different WebView
objects. From the documentation:
The unique identifier for the preferences—it is fixed to the keys used to store the receiver’s preferences in the user defaults database.
WebView
objects can share instances of theWebPreferences
class by using the same preferences identifier.This method sets the receiver’s preferences to the specified preferences object if it exists. Otherwise, this method creates a new
WebPreferences
object for the receiver initialized with anIdentifier. Use this method to change the preferences used by the receiver’sWebFrameView
objects. If you do not directly set the preferences,WebFrameView
objects use the preferences returned by thestandardPreferences
class method ofWebPreferences
.
If you want to reference a WebView
object in code, the most common options are setting an IBOutlet
or using tag
.
精彩评论