Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/extensions/Variables/includes/ExtVariables.php on line 198
UIFontChooser: Difference between revisions - iPhone Development Wiki

UIFontChooser: Difference between revisions

From iPhone Development Wiki
mNo edit summary
m (→‎Methods of UIFontChooser: Remove the wrong 3.1 upper limit.)
Line 5: Line 5:
== Methods of UIFontChooser ==
== Methods of UIFontChooser ==
=== +sharedFontChooser ===
=== +sharedFontChooser ===
{{Function signature|signature=+(UIFontChooser*)sharedFontChooser;|firmware=2.0 – 3.1}}
{{Function signature|signature=+(UIFontChooser*)sharedFontChooser;|firmware=2.0 –}}


Create a font chooser view. It will be initialized to have a frame equal to the main screen size.
Create a font chooser view. It will be initialized to have a frame equal to the main screen size.


=== -selectedFamilyName ===
=== -selectedFamilyName ===
{{Function signature|signature=-(NSString*)selectedFamilyName;|firmware=2.0 – 3.1}}
{{Function signature|signature=-(NSString*)selectedFamilyName;|firmware=2.0 –}}


Returns the selected font family name, or <tt>nil</tt> if none are selected.
Returns the selected font family name, or <tt>nil</tt> if none are selected.


=== -selectedSize ===
=== -selectedSize ===
{{Function signature|signature=-(CGFloat)selectedSize;|firmware=2.0 – 3.1}}
{{Function signature|signature=-(CGFloat)selectedSize;|firmware=2.0 –}}


Returns the selected font size, or 0 if the size field is left empty.
Returns the selected font size, or 0 if the size field is left empty.


=== delegate ===
=== delegate ===
{{Function signature|signature=@property(assign,nonatomic) id delegate;|firmware=2.0 – 3.1}}
{{Function signature|signature=@property(assign,nonatomic) id delegate;|firmware=2.0 –}}
Give the font chooser a delegate to respond to. It must conform to the informal protocol:
Give the font chooser a delegate to respond to. It must conform to the informal protocol:
<source lang="objc">
<source lang="objc">
Line 32: Line 32:
</source>
</source>


Note: If you implement <tt>-showKeyboardForFontChooser:</tt>, you must implement <tt>-hideKeyboardForFontChooser:</tt> as well.  
Note: If you implement <tt>-showKeyboardForFontChooser:</tt>, you must implement <tt>-hideKeyboardForFontChooser:</tt> as well.


== References ==
== References ==

Revision as of 09:18, 6 February 2010

Error creating thumbnail: File missing

UIFontChooser is a view that can choose a font family. It is very primitive, and it is better to implement a custom UIPickerView instead.

Methods of UIFontChooser

+sharedFontChooser

Signature +(UIFontChooser*)sharedFontChooser;
Available in 2.0 –

Create a font chooser view. It will be initialized to have a frame equal to the main screen size.

-selectedFamilyName

Signature -(NSString*)selectedFamilyName;
Available in 2.0 –

Returns the selected font family name, or nil if none are selected.

-selectedSize

Signature -(CGFloat)selectedSize;
Available in 2.0 –

Returns the selected font size, or 0 if the size field is left empty.

delegate

Signature @property(assign,nonatomic) id delegate;
Available in 2.0 –

Give the font chooser a delegate to respond to. It must conform to the informal protocol:

@protocol UIFontChooserDelegate
@optional
-(void)showKeyboardForFontChooser:(UIFontChooser*)fontChooser;
-(void)hideKeyboardForFontChooser:(UIFontChooser*)fontChooser;
-(void)fontChooserDidChangeFamilyName:(UIFontChooser*)fontChooser;
-(void)fontChooserDidChangeSize:(UIFontChooser*)fontChooser;
@end

Note: If you implement -showKeyboardForFontChooser:, you must implement -hideKeyboardForFontChooser: as well.

References