145 displaying fonts in the system

Source: Internet
Author: User

The effect is as follows:

ViewController.h

1 #import <UIKit/UIKit.h>23@interface  viewcontroller: Uitableviewcontroller4 @property (Strong, Nonatomic) Nsarray *arrfontname; 5 @property (Strong, Nonatomic) Nsarray *Arrfont; 6 @property (Strong, Nonatomic) nsdictionary *dicfontsize; 7 8 @end

Viewcontroller.m

1 #import "ViewController.h"2 3 @interfaceViewcontroller ()4- (void) Layoutui;5 @end6 7 @implementationViewcontroller8 9- (void) Viewdidload {Ten [Super Viewdidload]; One      A [self layoutui]; - } -  the- (void) didreceivememorywarning { - [Super didreceivememorywarning]; -     //Dispose of any resources the can be recreated. - } +  -- (void) Layoutui { +Self.navigationItem.title =@"display fonts in the system"; A      atCGFloat fontSize = [Uifont systemfontsize];//[Uifont systemfontsize]=14 -_arrfontname = @[@"System Font Size", -                      @"Small System Font Size", -                      @"Bold System Font of Size", -                      @"Italic System Font of Size", -                      @"Button Font Size", in                      @"Label Font Size"]; -_arrfont =@[[uifont Systemfontofsize:fontsize], to[Uifont Systemfontofsize:[uifont Smallsystemfontsize]],//[Uifont smallsystemfontsize]=12 + [Uifont boldsystemfontofsize:fontsize], - [Uifont italicsystemfontofsize:fontsize], the[Uifont Systemfontofsize:[uifont Buttonfontsize]],//[Uifont buttonfontsize]=18 *[Uifont Systemfontofsize:[uifont Labelfontsize]];//[Uifont labelfontsize]=17 $     Panax Notoginseng_dicfontsize = @{_arrfontname[0] :@" -", -_arrfontname[1] :@" A", the_arrfontname[2] :@" -", +_arrfontname[3] :@" -", A_arrfontname[4] :@" -", the_arrfontname[5] :@" -", +                      }; - } $  $ #pragmaMark-tableview --(NSString *) TableView: (UITableView *) TableView titleforheaderinsection: (nsinteger) Section { -     returnNil; the } - Wuyi-(Nsinteger) Numberofsectionsintableview: (UITableView *) TableView { the     return 1; - } Wu  --(Nsinteger) TableView: (UITableView *) TableView numberofrowsinsection: (nsinteger) Section { About     return[_arrfontname Count]; $ } -  --(UITableViewCell *) TableView: (UITableView *) TableView Cellforrowatindexpath: (Nsindexpath *) Indexpath { -     StaticNSString *cellidentifier =@"Cellidentifier"; AUITableViewCell *cell =[TableView Dequeuereusablecellwithidentifier:cellidentifier]; +     if(!cell) { theCell =[[UITableViewCell alloc] Initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier]; -     } $      theNsinteger row =Indexpath.row; theCell.textLabel.text = [NSString stringWithFormat:@"%@ (fontsize:%@)", the _arrfontname[row], the [_dicfontsize Objectforkey:_arrfontname[row]]; -Cell.textLabel.font =_arrfont[row]; in     returncell; the } the  About- (void) TableView: (UITableView *) TableView Didselectrowatindexpath: (Nsindexpath *) Indexpath { the      the } the  + @end

AppDelegate.h

1 #import <UIKit/UIKit.h>23@interface Appdelegate:uiresponder < Uiapplicationdelegate>4 @property (Strong, Nonatomic) UIWindow *window; 5 @property (Strong, Nonatomic) Uinavigationcontroller *Navigationcontroller; 6 7 @end

Appdelegate.m

1 #import "AppDelegate.h"2 #import "ViewController.h"3 4 @interfaceappdelegate ()5 @end6 7 @implementationappdelegate8 9-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) launchoptions {Ten_window =[[UIWindow alloc] initwithframe:[[uiscreen mainscreen] bounds]; OneViewcontroller *viewcontroller =[[Viewcontroller alloc] init]; A_navigationcontroller =[[Uinavigationcontroller alloc] initwithrootviewcontroller:viewcontroller]; -_window.rootviewcontroller =_navigationcontroller; -     //[_window Addsubview:_navigationcontroller.view];//when _window.rootviewcontroller is associated, this sentence is optional the [_window makekeyandvisible]; -     returnYES; - } -  +- (void) Applicationwillresignactive: (UIApplication *) Application { - } +  A- (void) Applicationdidenterbackground: (UIApplication *) Application { at } -  -- (void) Applicationwillenterforeground: (UIApplication *) Application { - } -  -- (void) Applicationdidbecomeactive: (UIApplication *) Application { in } -  to- (void) Applicationwillterminate: (UIApplication *) Application { + } -  the @end

145 display fonts in the system

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.