Skip to content

Commit

Permalink
Added icon font categories
Browse files Browse the repository at this point in the history
  • Loading branch information
rickardp committed Jun 13, 2015
1 parent ae77e84 commit 473bdd1
Show file tree
Hide file tree
Showing 22 changed files with 934 additions and 285 deletions.
2 changes: 1 addition & 1 deletion Controllers/IQDrilldownController.m
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ - (void) pushViewController:(UIViewController*)viewController animated:(BOOL)ani
} else {
[self.view addSubview:panel];
}
activeIndex = panels.count - 1;
activeIndex = (int)panels.count - 1;

CGRect bounds = self.view.bounds;
CGFloat width = panelWidth;
Expand Down
10 changes: 5 additions & 5 deletions Controllers/IQMenuViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ @interface IQMenuSection () {
- (void) _setParent:(IQMenuViewController*)menu;
- (BOOL) _displaying;
- (NSArray*) _items;
- (int) _displayIndexForItem:(IQMenuItem*)item;
- (NSInteger) _displayIndexForItem:(IQMenuItem*)item;
@end

typedef void (^_IQActionBlock)();
Expand Down Expand Up @@ -334,7 +334,7 @@ - (IQMenuViewController*) menuViewController
return parent;
}

- (int) _displayIndexForItem:(IQMenuItem*)item
- (NSInteger) _displayIndexForItem:(IQMenuItem*)item
{
NSInteger index = 0;
for(IQMenuItem* i in items) {
Expand Down Expand Up @@ -509,7 +509,7 @@ - (void) setHidden:(BOOL)newHiddenState animated:(BOOL)animated
self->hidden = newHiddenState;
BOOL isDisplaying = parent._displaying;
if(wasDisplaying && isDisplaying) {
int index = [parent._items indexOfObject:self];
NSUInteger index = [parent._items indexOfObject:self];
if(index == NSNotFound) [NSException raise:@"ItemNotFound" format:@"Item %@ not in parent section", self];
if(!newHiddenState) {
[self.menuViewController _itemAdded:index inSection:parent shouldAnimate:animated];
Expand Down Expand Up @@ -565,7 +565,7 @@ - (IQMenuSection*) sectionAtIndex:(NSInteger)index
count++;
}
}
[NSException raise:@"SectionIndexOutOfBounds" format:@"Section index %d out of bounds", index];
[NSException raise:@"SectionIndexOutOfBounds" format:@"Section index %ld out of bounds", (long)index];
return nil;
}

Expand All @@ -590,7 +590,7 @@ - (IQMenuItem*) itemAtSection:(NSInteger)section index:(NSInteger)index
if(count++ == index) return item;
}
}
[NSException raise:@"ItemIndexOutOfBounds" format:@"Item index %d out of bounds", index];
[NSException raise:@"ItemIndexOutOfBounds" format:@"Item index %ld out of bounds", (long)index];
return nil;
}

Expand Down
Binary file added [email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions Example/Base.lproj/LaunchScreen.xib
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="15A178w" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
<rect key="frame" x="20" y="439" width="441" height="21"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="IQWidgetsExample" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
<rect key="frame" x="20" y="140" width="441" height="43"/>
<animations/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/>
<constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>
<constraint firstAttribute="bottom" secondItem="8ie-xW-0ye" secondAttribute="bottom" constant="20" id="Kzo-t9-V3l"/>
<constraint firstItem="8ie-xW-0ye" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="MfP-vx-nX0"/>
<constraint firstAttribute="centerX" secondItem="8ie-xW-0ye" secondAttribute="centerX" id="ZEH-qu-HZ9"/>
<constraint firstItem="kId-c2-rCX" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="fvb-Df-36g"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="548" y="455"/>
</view>
</objects>
</document>
2 changes: 1 addition & 1 deletion Example/Example-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<string>IQex</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>UIFileSharingEnabled</key>
Expand Down
54 changes: 54 additions & 0 deletions Example/ExampleApp.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,60 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application
[self navigateTo:[[MonthCalendarExample alloc] init]];
}] animated:NO];
[menu addSection:dateTimeSection animated:NO];
IQMenuSection* utilitySection = [IQMenuSection sectionWithTitle:@"Utilities"];
[utilitySection addItem:[IQMenuItem itemWithTitle:@"Icon fonts" action:^{
UITabBarController* vc = [UITabBarController new];
UIViewController* tab1 = [UIViewController new];
tab1.tabBarItem.title = @"Tab 1";
tab1.tabBarItem.iconFontResource = @"LigatureSymbols";
tab1.tabBarItem.iconSymbol = @"app";
UIViewController* tab2 = [UIViewController new];
tab2.tabBarItem.title = @"Tab 2";
tab2.tabBarItem.iconFontResource = @"FontAwesome";
tab2.tabBarItem.iconSymbol = @"0xf1ea";

tab1.view.backgroundColor = tab2.view.backgroundColor = [UIColor whiteColor];
vc.viewControllers = @[tab1, tab2];

UILabel* lbl = [[UILabel alloc] initWithFrame:CGRectMake(10, 60, 200, 30)];
lbl.text = @"Static icon (UIImageView):";
lbl.font = [UIFont systemFontOfSize:10];
lbl.tintColor = [UIColor darkGrayColor];
[tab1.view addSubview:lbl];

UIImageView* l = [[UIImageView alloc] initWithFrame:CGRectMake(10, 90, 90, 40)];
l.contentMode = UIViewContentModeScaleAspectFit;
l.iconFontResource = @"LigatureSymbols";
l.iconSymbol = @"tag";
[tab1.view addSubview:l];
l = [[UIImageView alloc] initWithFrame:CGRectMake(100, 90, 90, 40)];
l.contentMode = UIViewContentModeScaleAspectFit;
l.iconFontResource = @"FontAwesome";
l.iconSymbol = @"0xf1e3";
[tab1.view addSubview:l];

lbl = [[UILabel alloc] initWithFrame:CGRectMake(10, 130, 200, 30)];
lbl.text = @"Push button (UIButton):";
lbl.font = [UIFont systemFontOfSize:10];
lbl.tintColor = [UIColor darkGrayColor];
[tab1.view addSubview:lbl];
UIButton* btn = [UIButton buttonWithType:UIButtonTypeCustom];
btn.frame = CGRectMake(10, 160, 90, 90);
[btn setTitle:@"Hej" forState:UIControlStateNormal];
[tab1.view addSubview:btn];

lbl = [[UILabel alloc] initWithFrame:CGRectMake(10, 230, 200, 30)];
lbl.text = @"Segmented (UISegmentedControl):";
lbl.font = [UIFont systemFontOfSize:10];
lbl.tintColor = [UIColor darkGrayColor];
[tab1.view addSubview:lbl];
UISegmentedControl* sc = [[UISegmentedControl alloc] initWithItems:@[@"A", @"B", @"C"]];
sc.frame = CGRectMake(10, 260, 90, 26);
[tab1.view addSubview:sc];

[self navigateTo:vc];
}] animated:NO];
[menu addSection:utilitySection animated:NO];

IQMenuSection* themeSection = [IQMenuSection sectionWithTitle:@"Themes"];
[themeSection addItem:[IQMenuItem itemWithTitle:@"Default" action:^{
Expand Down
68 changes: 68 additions & 0 deletions Example/Images.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Binary file added FontAwesome.otf
Binary file not shown.
2 changes: 1 addition & 1 deletion IQCalendarDataSource.m
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ - (void) enumerateEntriesUsing:(IQCalendarDataSourceEntryCallback)enumerator fro

if(!value && (start || end)) {
value = ^(id item) {
if([item respondsToSelector:@selector(text)]) {
if([item respondsToSelector:@selector(value)]) {
return (NSObject<IQCalendarActivity>*)[(id<IQCalendarSimpleDataItem>)item value];
} else {
return (NSObject<IQCalendarActivity>*)nil;
Expand Down
1 change: 1 addition & 0 deletions IQWidgets.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#import "IQGanttView.h"
#import "IQCalendarDataSource.h"
#import "IQDrawerView.h"
#import "IQIconFont.h"
#import "IQTheme.h"
#import "IQThemeCSS.h"

Loading

0 comments on commit 473bdd1

Please sign in to comment.