Skip to content

Commit

Permalink
fix some thing
Browse files Browse the repository at this point in the history
  • Loading branch information
DuckDeck committed May 10, 2018
1 parent 8c35373 commit 11993f5
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 13 deletions.
4 changes: 2 additions & 2 deletions GrandMenu.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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 ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
Expand Down
44 changes: 39 additions & 5 deletions GrandMenu/GrandMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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!
}
}
}
Expand All @@ -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)->())?

Expand Down Expand Up @@ -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
Expand Down
11 changes: 7 additions & 4 deletions GrandMenu/GrandMenuItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down Expand Up @@ -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{
Expand Down
Binary file modified GrandMenuDemo/.DS_Store
Binary file not shown.
6 changes: 5 additions & 1 deletion GrandMenuDemo/GrandMenuDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0900;
LastUpgradeCheck = 0930;
ORGANIZATIONNAME = Qfq;
TargetAttributes = {
A205AA6C1C488E880043F5F6 = {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
1 change: 0 additions & 1 deletion GrandMenuDemo/GrandMenuDemo/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 11993f5

Please sign in to comment.