diff --git a/GrandMenu.podspec b/GrandMenu.podspec index 0dfaba3..595e03f 100644 --- a/GrandMenu.podspec +++ b/GrandMenu.podspec @@ -16,7 +16,7 @@ Pod::Spec.new do |s| # s.name = "GrandMenu" - s.version = "1.1.2" + s.version = "1.1.3" s.summary = "GrandMenu is a powerful and simple Menu" # This description is used to generate tags and improve search results. @@ -80,7 +80,7 @@ Pod::Spec.new do |s| # Supports git, hg, bzr, svn and HTTP. # - s.source = { :git => "https://github.com/DuckDeck/GrandMenu.git", :tag => "1.1.2" } + s.source = { :git => "https://github.com/DuckDeck/GrandMenu.git", :tag => "1.1.3" } # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # diff --git a/GrandMenu/GrandMenu.swift b/GrandMenu/GrandMenu.swift index b7a8730..c0e4f05 100644 --- a/GrandMenu/GrandMenu.swift +++ b/GrandMenu/GrandMenu.swift @@ -57,7 +57,20 @@ open class GrandMenu: UIView,GraneMenuItemDelegate { } if let items = arrItems{ for item in items{ - item.fontSize = itemFont! + item.Font = UIFont.systemFont(ofSize: CGFloat(itemFont!)) + } + } + } + } + + open var itemUIFont:UIFont?{ + didSet{ + if itemUIFont == nil{ + return + } + if let items = arrItems{ + for item in items{ + item.Font = itemUIFont! } } } @@ -70,12 +83,25 @@ open class GrandMenu: UIView,GraneMenuItemDelegate { } if let items = arrItems{ for item in items{ - item.selectedFontSize = itemSelectedFont! + item.selectedFont = UIFont.systemFont(ofSize: CGFloat(itemSelectedFont!)) } } } } + open var itemSelectedUIFont:UIFont?{ + didSet{ + + if itemSelectedUIFont == nil{ + return + } + if let items = arrItems{ + for item in items{ + item.selectedFont = itemSelectedUIFont! + } + } + } + } open var selectMenu:((_ item:GrandMenuItem, _ index:Int)->())? @@ -150,13 +176,21 @@ open class GrandMenu: UIView,GraneMenuItemDelegate { item.selectedColor = itemSeletedColor item.color = itemColor if let f = itemFont{ - item.fontSize = f + item.Font = UIFont.systemFont(ofSize: CGFloat(f)) + } + if let f = itemUIFont{ + item.Font = f } if let sf = itemSelectedFont{ - item.selectedFontSize = sf + item.selectedFont = UIFont.systemFont(ofSize: CGFloat(sf)) } + + if let sf = itemSelectedUIFont{ + item.selectedFont = sf + } + item.delegate = weakSelf - var itemWidth = GrandMenuItem.getTitleWidth(title, fontSize: item.fontSize, leftrightOffset: itemLeftRightOffset) + var itemWidth = GrandMenuItem.getTitleWidth(title, fontSize: Float(item.Font.pointSize), leftrightOffset: itemLeftRightOffset) if itemWidth > maxItemWidth{ maxItemWidth = itemWidth diff --git a/GrandMenu/GrandMenuItem.swift b/GrandMenu/GrandMenuItem.swift index ca4c66d..e191497 100644 --- a/GrandMenu/GrandMenuItem.swift +++ b/GrandMenu/GrandMenuItem.swift @@ -23,12 +23,15 @@ open class GrandMenuItem: UIView { } } - var fontSize:Float = 15{ + + + var Font:UIFont = UIFont.systemFont(ofSize: 15){ didSet{ setNeedsDisplay() } } - var selectedFontSize:Float = 17{ + + var selectedFont:UIFont = UIFont.systemFont(ofSize: 15){ didSet{ setNeedsDisplay() } @@ -79,10 +82,10 @@ open class GrandMenuItem: UIView { } func titleFont()->UIFont{ if selected{ - return UIFont.boldSystemFont(ofSize: CGFloat(selectedFontSize)) + return selectedFont } else{ - return UIFont.boldSystemFont(ofSize: CGFloat(fontSize)) + return Font } } func titleColor()->UIColor{ diff --git a/GrandMenuDemo/.DS_Store b/GrandMenuDemo/.DS_Store index b168732..1e98a40 100644 Binary files a/GrandMenuDemo/.DS_Store and b/GrandMenuDemo/.DS_Store differ diff --git a/GrandMenuDemo/GrandMenuDemo.xcodeproj/project.pbxproj b/GrandMenuDemo/GrandMenuDemo.xcodeproj/project.pbxproj index aae637b..1c3373e 100644 --- a/GrandMenuDemo/GrandMenuDemo.xcodeproj/project.pbxproj +++ b/GrandMenuDemo/GrandMenuDemo.xcodeproj/project.pbxproj @@ -167,7 +167,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0720; - LastUpgradeCheck = 0900; + LastUpgradeCheck = 0930; ORGANIZATIONNAME = Qfq; TargetAttributes = { A205AA6C1C488E880043F5F6 = { @@ -262,12 +262,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -314,12 +316,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; diff --git a/GrandMenuDemo/GrandMenuDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/GrandMenuDemo/GrandMenuDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/GrandMenuDemo/GrandMenuDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/GrandMenuDemo/GrandMenuDemo/ViewController.swift b/GrandMenuDemo/GrandMenuDemo/ViewController.swift index 69b6266..6031284 100644 --- a/GrandMenuDemo/GrandMenuDemo/ViewController.swift +++ b/GrandMenuDemo/GrandMenuDemo/ViewController.swift @@ -20,7 +20,6 @@ class ViewController: UIViewController,UITableViewDelegate,UITableViewDataSource tbMenu?.delegate = self tbMenu?.tableFooterView = UIView() view.addSubview(tbMenu!) - } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return arrMenu.count