Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor, updated readme, colors+style to closer match Sparrow #1

Merged
merged 3 commits into from
May 26, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion OCExpandableButton.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ typedef enum {
- (id)initWithFrame:(CGRect)frame;

//These are the views that show in the bar when the control is expanded.
- (void)setSubviews:(NSArray *)subviews;
- (void)setOptionViews:(NSArray *)subviews;

//Opens the control if the control is currently closed. No effect if the button
// is already open.
Expand Down
292 changes: 149 additions & 143 deletions OCExpandableButton.m

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions OCExpandableButton.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
B1E7DBC1174847E3003291C6 /* OCViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OCViewController.h; sourceTree = "<group>"; };
B1E7DBC2174847E3003291C6 /* OCViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OCViewController.m; sourceTree = "<group>"; };
B1E7DBC5174847E3003291C6 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/OCViewController.xib; sourceTree = "<group>"; };
B1E7DBCC174847F3003291C6 /* OCExpandableButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OCExpandableButton.h; path = ../OCExpandableButton.h; sourceTree = "<group>"; };
B1E7DBCD174847F3003291C6 /* OCExpandableButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OCExpandableButton.m; path = ../OCExpandableButton.m; sourceTree = "<group>"; };
B1E7DBCC174847F3003291C6 /* OCExpandableButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCExpandableButton.h; sourceTree = "<group>"; };
B1E7DBCD174847F3003291C6 /* OCExpandableButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OCExpandableButton.m; sourceTree = "<group>"; };
B1E7DBCF174848D3003291C6 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */

Expand All @@ -62,6 +62,8 @@
B1E7DB9D174847E3003291C6 = {
isa = PBXGroup;
children = (
B1E7DBCC174847F3003291C6 /* OCExpandableButton.h */,
B1E7DBCD174847F3003291C6 /* OCExpandableButton.m */,
B1E7DBAF174847E3003291C6 /* OCExpandableButton */,
B1E7DBA8174847E3003291C6 /* Frameworks */,
B1E7DBA7174847E3003291C6 /* Products */,
Expand Down Expand Up @@ -95,8 +97,6 @@
B1E7DBC1174847E3003291C6 /* OCViewController.h */,
B1E7DBC2174847E3003291C6 /* OCViewController.m */,
B1E7DBC4174847E3003291C6 /* OCViewController.xib */,
B1E7DBCC174847F3003291C6 /* OCExpandableButton.h */,
B1E7DBCD174847F3003291C6 /* OCExpandableButton.m */,
B1E7DBB0174847E3003291C6 /* Supporting Files */,
);
path = OCExpandableButton;
Expand Down Expand Up @@ -309,6 +309,7 @@
B1E7DBCB174847E3003291C6 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
Expand Down
2 changes: 1 addition & 1 deletion OCExpandableButton/OCViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ - (void)viewDidAppear:(BOOL)animated {

//You can open/close the button using the public methods. So if you wanted
// to close the button on scroll or orientation change, you can do that.
[button open];
// [button open];
}

- (void)tapped {
Expand Down
23 changes: 11 additions & 12 deletions OCExpandableButton/en.lproj/OCViewController.xib
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1536</int>
<string key="IBDocument.SystemVersion">12A269</string>
<string key="IBDocument.InterfaceBuilderVersion">2835</string>
<string key="IBDocument.AppKitVersion">1187</string>
<string key="IBDocument.HIToolboxVersion">624.00</string>
<int key="IBDocument.SystemTarget">1552</int>
<string key="IBDocument.SystemVersion">12D78</string>
<string key="IBDocument.InterfaceBuilderVersion">3084</string>
<string key="IBDocument.AppKitVersion">1187.37</string>
<string key="IBDocument.HIToolboxVersion">626.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">1919</string>
<string key="NS.object.0">2083</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>IBProxyObject</string>
Expand All @@ -33,16 +33,14 @@
<object class="IBUIView" id="774585933">
<reference key="NSNextResponder"/>
<int key="NSvFlags">274</int>
<array class="NSMutableArray" key="NSSubviews"/>
<string key="NSFrame">{{0, 20}, {320, 548}}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<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">MC45OAA</bytes>
</object>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
Expand Down Expand Up @@ -99,6 +97,7 @@
<object class="IBObjectRecord">
<int key="objectID">6</int>
<reference key="object" ref="774585933"/>
<array class="NSMutableArray" key="children"/>
<reference key="parent" ref="0"/>
</object>
</array>
Expand All @@ -114,7 +113,7 @@
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">7</int>
<int key="maxID">17</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
Expand All @@ -133,6 +132,6 @@
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<bool key="IBDocument.UseAutolayout">YES</bool>
<string key="IBCocoaTouchPluginVersion">1919</string>
<string key="IBCocoaTouchPluginVersion">2083</string>
</data>
</archive>
Binary file added animation.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 6 additions & 9 deletions readme.markdown
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
#OCExpandableButton#

![Component in closed state](https://raw.github.com/ocrickard/OCExpandableButton/master/screen1.PNG)
![Component in open state](https://raw.github.com/ocrickard/OCExpandableButton/master/screen2.PNG)

##Intro##

OCExpandableButton is a VERY simple component in native Objective C that mimics the behavior of the expanding menu in the Sparrow mail app. You give it an array of subviews, and it presents them when it's activated. It is a normal subview, so you're in charge of rotation, and anything extra.

<p align="center"><img src="https://raw.github.com/rnystrom/OCExpandableButton/master/animation.gif"/></p>

##Usage##

Usage of the control is totally simple, it works just like any other UIView:

```
```objc
button = [[OCExpandableButton alloc] initWithFrame:CGRectMake(self.view.bounds.size.width - 57, self.view.bounds.size.height - 57, 37, 37) subviews:subviews];
[self.view addSubview:button];
```
Expand All @@ -20,7 +17,7 @@ The array of subviews will be positioned and aligned upon opening of the control

If you want to manually open/close the component (say the screen rotates, or the user begins to scroll), then you can use the following methods:

```
```objc
//Opens the control if the control is currently closed. No effect if the button
// is already open.
- (void)open;
Expand All @@ -30,11 +27,11 @@ If you want to manually open/close the component (say the screen rotates, or the
```

You can make the component reveal with left or right alignment using:
```
```objc
button.alignment = OCExpandableButtonAlignmentLeft;
```
or
```
```objc
button.alignment = OCExpandableButtonAlignmentRight;
```

Expand Down
Binary file removed screen1.PNG
Binary file not shown.
Binary file removed screen2.PNG
Binary file not shown.