Skip to content

Commit

Permalink
Nearly finished
Browse files Browse the repository at this point in the history
  • Loading branch information
graetzer committed Jun 10, 2012
1 parent ee03c3a commit 0c43f6e
Show file tree
Hide file tree
Showing 13 changed files with 346 additions and 186 deletions.
12 changes: 6 additions & 6 deletions Demo/SGTabs.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
F470D28B1580EA5100ED3644 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = F470D28A1580EA5100ED3644 /* main.m */; };
F470D28F1580EA5100ED3644 /* SGAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = F470D28E1580EA5100ED3644 /* SGAppDelegate.m */; };
F470D2921580EA5100ED3644 /* SGViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F470D2911580EA5100ED3644 /* SGViewController.m */; };
F470D2951580EA5100ED3644 /* SGViewController_iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = F470D2931580EA5100ED3644 /* SGViewController_iPhone.xib */; };
F470D2951580EA5100ED3644 /* SGViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = F470D2931580EA5100ED3644 /* SGViewController.xib */; };
F470D2A91580EAD700ED3644 /* SGTabsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F470D2A81580EAD700ED3644 /* SGTabsViewController.m */; };
F470D2AC1580ECDB00ED3644 /* SGTabsView.m in Sources */ = {isa = PBXBuildFile; fileRef = F470D2AB1580ECDB00ED3644 /* SGTabsView.m */; };
F470D2AF1580ECE700ED3644 /* SGTabView.m in Sources */ = {isa = PBXBuildFile; fileRef = F470D2AE1580ECE700ED3644 /* SGTabView.m */; };
Expand All @@ -34,7 +34,7 @@
F470D28E1580EA5100ED3644 /* SGAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGAppDelegate.m; sourceTree = "<group>"; };
F470D2901580EA5100ED3644 /* SGViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGViewController.h; sourceTree = "<group>"; };
F470D2911580EA5100ED3644 /* SGViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGViewController.m; sourceTree = "<group>"; };
F470D2941580EA5100ED3644 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/SGViewController_iPhone.xib; sourceTree = "<group>"; };
F470D2941580EA5100ED3644 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/SGViewController.xib; sourceTree = "<group>"; };
F470D2A71580EAD700ED3644 /* SGTabsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGTabsViewController.h; sourceTree = "<group>"; };
F470D2A81580EAD700ED3644 /* SGTabsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGTabsViewController.m; sourceTree = "<group>"; };
F470D2AA1580ECDB00ED3644 /* SGTabsView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGTabsView.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -102,7 +102,7 @@
F470D28E1580EA5100ED3644 /* SGAppDelegate.m */,
F470D2901580EA5100ED3644 /* SGViewController.h */,
F470D2911580EA5100ED3644 /* SGViewController.m */,
F470D2931580EA5100ED3644 /* SGViewController_iPhone.xib */,
F470D2931580EA5100ED3644 /* SGViewController.xib */,
F476BFBE15816C8E00BABEEB /* Source */,
F470D2851580EA5100ED3644 /* Supporting Files */,
);
Expand Down Expand Up @@ -206,7 +206,7 @@
buildActionMask = 2147483647;
files = (
F470D2891580EA5100ED3644 /* InfoPlist.strings in Resources */,
F470D2951580EA5100ED3644 /* SGViewController_iPhone.xib in Resources */,
F470D2951580EA5100ED3644 /* SGViewController.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -238,12 +238,12 @@
name = InfoPlist.strings;
sourceTree = "<group>";
};
F470D2931580EA5100ED3644 /* SGViewController_iPhone.xib */ = {
F470D2931580EA5100ED3644 /* SGViewController.xib */ = {
isa = PBXVariantGroup;
children = (
F470D2941580EA5100ED3644 /* en */,
);
name = SGViewController_iPhone.xib;
name = SGViewController.xib;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
Expand Down
2 changes: 1 addition & 1 deletion Demo/SGTabs/SGAppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@

@property (strong, nonatomic) UIWindow *window;

@property (strong, nonatomic) SGTabsViewController *viewController;
@property (strong, nonatomic) SGTabsViewController *tabController;

@end
44 changes: 11 additions & 33 deletions Demo/SGTabs/SGAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@

#import "SGAppDelegate.h"

#import "SGViewController.h"
#import "SGTabsViewController.h"

@implementation SGAppDelegate

@synthesize window = _window;
@synthesize viewController = _viewController;
@synthesize tabController = _tabController;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
Expand All @@ -39,47 +40,24 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
// self.viewController = [[SGViewController alloc] initWithNibName:@"SGViewController_iPad" bundle:nil];
// }

self.viewController = [[SGTabsViewController alloc] initWithNibName:nil bundle:nil];
self.window.rootViewController = self.viewController;
self.tabController = [[SGTabsViewController alloc] initEditable:YES];
self.window.rootViewController = self.tabController;
[self.window makeKeyAndVisible];
[self.viewController addBlankTab:@"Hello World"];

[self openTab];
timer = [NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:@selector(openTab) userInfo:nil repeats:YES];

return YES;
}

- (void)openTab {
if (self.viewController.maxTabs > self.viewController.count) {
[self.viewController addBlankTab:@"Hello Tab"];
if (3 > self.tabController.count) { // You can add up to tabController.maxCount Tabs
SGViewController *vc = [[SGViewController alloc]
initWithNibName:NSStringFromClass([SGViewController class])
bundle:nil];
vc.title = [NSString stringWithFormat:@"Tab %i content", self.tabController.count+1];
[self.tabController addTab:vc];
}
}

- (void)applicationWillResignActive:(UIApplication *)application
{
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

- (void)applicationDidEnterBackground:(UIApplication *)application
{
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

- (void)applicationWillEnterForeground:(UIApplication *)application
{
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

- (void)applicationDidBecomeActive:(UIApplication *)application
{
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

- (void)applicationWillTerminate:(UIApplication *)application
{
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

@end
7 changes: 3 additions & 4 deletions Demo/SGTabs/SGViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@

#import <UIKit/UIKit.h>

@class SGTabsViewController;
@interface SGViewController : UIViewController {
SGTabsViewController *inner;
}
@interface SGViewController : UIViewController

@property (weak, nonatomic) IBOutlet UILabel *label;

@end
3 changes: 3 additions & 0 deletions Demo/SGTabs/SGViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,18 @@ @interface SGViewController ()
@end

@implementation SGViewController
@synthesize label;

- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.label.text = self.title;
}

- (void)viewDidUnload
{
[self setLabel:nil];
[super viewDidUnload];
// Release any retained subviews of the main view.
}
Expand Down
88 changes: 63 additions & 25 deletions Demo/SGTabs/en.lproj/SGViewController.xib
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1280</int>
<string key="IBDocument.SystemVersion">11C25</string>
<string key="IBDocument.InterfaceBuilderVersion">1919</string>
<string key="IBDocument.AppKitVersion">1138.11</string>
<string key="IBDocument.HIToolboxVersion">566.00</string>
<int key="IBDocument.SystemTarget">1296</int>
<string key="IBDocument.SystemVersion">11E53</string>
<string key="IBDocument.InterfaceBuilderVersion">2182</string>
<string key="IBDocument.AppKitVersion">1138.47</string>
<string key="IBDocument.HIToolboxVersion">569.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">916</string>
<string key="NS.object.0">1181</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>IBProxyObject</string>
<string>IBUIView</string>
<string>IBUILabel</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
Expand All @@ -33,15 +34,42 @@
<object class="IBUIView" id="774585933">
<reference key="NSNextResponder"/>
<int key="NSvFlags">274</int>
<array class="NSMutableArray" key="NSSubviews">
<object class="IBUILabel" id="638580792">
<reference key="NSNextResponder" ref="774585933"/>
<int key="NSvFlags">274</int>
<string key="NSFrame">{{77, 83}, {167, 142}}</string>
<reference key="NSSuperview" ref="774585933"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">Label</string>
<object class="NSColor" key="IBUITextColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MCAwIDAAA</bytes>
</object>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">0</int>
<float key="IBUIMinimumFontSize">10</float>
<object class="IBUIFontDescription" key="IBUIFontDescription">
<int key="type">1</int>
<double key="pointSize">35</double>
</object>
<object class="NSFont" key="IBUIFont">
<string key="NSName">Helvetica</string>
<double key="NSSize">35</double>
<int key="NSfFlags">16</int>
</object>
</object>
</array>
<string key="NSFrame">{{0, 20}, {320, 460}}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC43NQA</bytes>
<object class="NSColorSpace" key="NSCustomColorSpace">
<int key="NSID">2</int>
</object>
<bytes key="NSWhite">MQA</bytes>
</object>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
Expand All @@ -58,6 +86,14 @@
</object>
<int key="connectionID">7</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">label</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="638580792"/>
</object>
<int key="connectionID">10</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
Expand All @@ -81,8 +117,16 @@
<object class="IBObjectRecord">
<int key="objectID">6</int>
<reference key="object" ref="774585933"/>
<array class="NSMutableArray" key="children">
<reference ref="638580792"/>
</array>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">9</int>
<reference key="object" ref="638580792"/>
<reference key="parent" ref="774585933"/>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
Expand All @@ -91,29 +135,23 @@
<string key="-2.CustomClassName">UIResponder</string>
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="6.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="9.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">7</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">SGViewController</string>
<string key="superclassName">UIViewController</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/SGViewController.h</string>
</object>
</object>
</array>
<int key="maxID">10</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes"/>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
<real value="1296" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">916</string>
<string key="IBCocoaTouchPluginVersion">1181</string>
</data>
</archive>
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ I provider my code under the Apache Licence.
Credits go to [Fictorial LLC][https://github.com/fictorial/BHTabBar], my tab control implementation is spired by BHTabBar


Copyright 2012 Simon Grätzer
Copyright 2012 Simon Grätzer

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
2 changes: 1 addition & 1 deletion Source/SGTabView.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
}

@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, assign) NSUInteger position;
@property (nonatomic, strong) UIButton *closeButton;
@property (nonatomic, assign) BOOL editable;

- (id)initWithFrame:(CGRect)frame title:(NSString *)title;
Expand Down
Loading

0 comments on commit 0c43f6e

Please sign in to comment.