Permalink
Browse files

fixed tolbar issue in PopupPicker

  • Loading branch information...
1 parent 4e0cb27 commit fc391e9123be5d086260a6abd7804713ead12687 @Malaar committed Jun 22, 2012
@@ -15,6 +15,7 @@ @interface MUPopupPicker (Private)
- (void) toolbarButtonPressed:(UIButton*)aSender;
- (void) toolbarItemPressed:(UIBarButtonItem*)aSender;
+- (void) configureFrames;
@end
@@ -45,8 +46,26 @@ - (void) setup
picker = [self createPicker];
[self addSubview:picker];
-// self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin;
-// picker.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+ [self configureFrames];
+}
+
+//==============================================================================
+- (void) configureFrames
+{
+ //
+ self.autoresizingMask ^= !(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin);
+ picker.autoresizingMask ^= !(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
+
+ CGRect frame = picker.frame;
+ frame.origin.y = toolbar.bounds.size.height;
+ picker.frame = frame;
+
+ frame.origin.y = 0;
+ frame.size.height += toolbar.bounds.size.height;
+ self.frame = frame;
+
+ self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin;
+ picker.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
}
@@ -59,28 +78,12 @@ - (void) setToolbar:(MUToolbar *)aToolbar
if(aToolbar)
{
toolbar = [aToolbar retain];
-
[self addSubview:toolbar];
-
[toolbar sizeToFit];
toolbar.autoresizingMask = UIViewAutoresizingFlexibleWidth;
- //
- self.autoresizingMask ^= !(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin);
- picker.autoresizingMask ^= !(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
-
- CGRect frame = picker.frame;
- frame.origin.y = toolbar.bounds.size.height;
- picker.frame = frame;
-
- frame.origin.y = 0;
- frame.size.height += toolbar.bounds.size.height;
- self.frame = frame;
+ [self configureFrames];
- self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin;
- picker.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
-
- //
int index = 0;
for(UIBarButtonItem* bbi in toolbar.items)
{
@@ -119,12 +122,6 @@ - (NSObject*) selectedItem
return nil; // override it in subclasses
}
-////==============================================================================
-//- (void) setSelectedItem:(NSObject *)aSelectedItem
-//{
-// // override it in subclasses
-//}
-
#pragma mark - Toolbar
//==============================================================================
- (void) toolbarButtonPressed:(UIButton*)aSender
@@ -16,5 +16,7 @@
- (IBAction)showKeyboardAvoidingTableView:(id)sender;
- (IBAction)showTableDisposerController:(id)sender;
- (IBAction)switchController:(id)sender;
+@property (retain, nonatomic) IBOutlet UIButton *popupPressed;
+- (IBAction)popupPressed:(id)sender;
@end
@@ -14,6 +14,7 @@
#import "MUSwitchController.h"
@implementation MURootControllerIPhone
+@synthesize popupPressed;
@synthesize ivTapable;
//==============================================================================
@@ -56,6 +57,7 @@ - (void)viewDidLoad
- (void)viewDidUnload
{
[self setIvTapable:nil];
+ [self setPopupPressed:nil];
[super viewDidUnload];
}
@@ -103,6 +105,7 @@ - (void)dealloc
{
[ivTapable release];
+ [popupPressed release];
[super dealloc];
}
@@ -112,4 +115,14 @@ - (void) imageTapped:(UIImage*)anImage
MUShowSimpleAlert(@"Image Tapable", @"image taped!");
}
+//==============================================================================
+- (IBAction)popupPressed:(id)sender
+{
+ MUPopupDatePicker* datePicker = [[MUPopupDatePicker alloc] init];
+ datePicker.showOverlayView = YES;
+// datePicker.toolbar = [MUToolbar new];
+ [datePicker prepareToShow];
+ [datePicker showWithAnimation:YES inView:self.view];
+}
+
@end
@@ -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">1280</int>
- <string key="IBDocument.SystemVersion">10K549</string>
- <string key="IBDocument.InterfaceBuilderVersion">1938</string>
- <string key="IBDocument.AppKitVersion">1038.36</string>
- <string key="IBDocument.HIToolboxVersion">461.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">933</string>
+ <string key="NS.object.0">1181</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>IBUIButton</string>
@@ -77,7 +77,7 @@
<string key="NSFrame">{{10, 47}, {300, 35}}</string>
<reference key="NSSuperview" ref="774585933"/>
<reference key="NSWindow"/>
- <reference key="NSNextKeyView"/>
+ <reference key="NSNextKeyView" ref="474465574"/>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
@@ -109,7 +109,7 @@
<string key="NSFrame">{{10, 87}, {300, 37}}</string>
<reference key="NSSuperview" ref="774585933"/>
<reference key="NSWindow"/>
- <reference key="NSNextKeyView" ref="683210156"/>
+ <reference key="NSNextKeyView" ref="952695764"/>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
@@ -146,6 +146,29 @@
<reference key="IBUIFontDescription" ref="25460880"/>
<reference key="IBUIFont" ref="625901813"/>
</object>
+ <object class="IBUIButton" id="952695764">
+ <reference key="NSNextResponder" ref="774585933"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{124, 132}, {72, 37}}</string>
+ <reference key="NSSuperview" ref="774585933"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="683210156"/>
+ <string key="NSReuseIdentifierKey">_NS:9</string>
+ <bool key="IBUIOpaque">NO</bool>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <int key="IBUIContentHorizontalAlignment">0</int>
+ <int key="IBUIContentVerticalAlignment">0</int>
+ <int key="IBUIButtonType">1</int>
+ <string key="IBUINormalTitle">Popup</string>
+ <reference key="IBUIHighlightedTitleColor" ref="79246973"/>
+ <object class="NSColor" key="IBUINormalTitleColor">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
+ </object>
+ <reference key="IBUINormalTitleShadowColor" ref="189390572"/>
+ <reference key="IBUIFontDescription" ref="25460880"/>
+ <reference key="IBUIFont" ref="625901813"/>
+ </object>
</array>
<string key="NSFrame">{{0, 20}, {320, 460}}</string>
<reference key="NSSuperview"/>
@@ -179,6 +202,14 @@
<int key="connectionID">17</int>
</object>
<object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">popupPressed</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="952695764"/>
+ </object>
+ <int key="connectionID">24</int>
+ </object>
+ <object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">showKeyboardAvoidingScrollView:</string>
<reference key="source" ref="849742732"/>
@@ -214,6 +245,15 @@
</object>
<int key="connectionID">22</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchEventConnection" key="connection">
+ <string key="label">popupPressed:</string>
+ <reference key="source" ref="952695764"/>
+ <reference key="destination" ref="372490531"/>
+ <int key="IBEventType">7</int>
+ </object>
+ <int key="connectionID">25</int>
+ </object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
@@ -243,6 +283,7 @@
<reference ref="683210156"/>
<reference ref="474465574"/>
<reference ref="458275499"/>
+ <reference ref="952695764"/>
</array>
<reference key="parent" ref="0"/>
</object>
@@ -271,6 +312,11 @@
<reference key="object" ref="458275499"/>
<reference key="parent" ref="774585933"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">23</int>
+ <reference key="object" ref="952695764"/>
+ <reference key="parent" ref="774585933"/>
+ </object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
@@ -283,14 +329,15 @@
<string key="16.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="18.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="20.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="23.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">22</int>
+ <int key="maxID">25</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -329,17 +376,20 @@
<string key="candidateClassName">id</string>
</object>
</dictionary>
- <object class="NSMutableDictionary" key="outlets">
- <string key="NS.key.0">ivTapable</string>
- <string key="NS.object.0">MUImageViewTapable</string>
- </object>
- <object class="NSMutableDictionary" key="toOneOutletInfosByName">
- <string key="NS.key.0">ivTapable</string>
- <object class="IBToOneOutletInfo" key="NS.object.0">
+ <dictionary class="NSMutableDictionary" key="outlets">
+ <string key="ivTapable">MUImageViewTapable</string>
+ <string key="popupPressed">UIButton</string>
+ </dictionary>
+ <dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
+ <object class="IBToOneOutletInfo" key="ivTapable">
<string key="name">ivTapable</string>
<string key="candidateClassName">MUImageViewTapable</string>
</object>
- </object>
+ <object class="IBToOneOutletInfo" key="popupPressed">
+ <string key="name">popupPressed</string>
+ <string key="candidateClassName">UIButton</string>
+ </object>
+ </dictionary>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/MURootControllerIPhone.h</string>
@@ -351,10 +401,10 @@
<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="1280" key="NS.object.0"/>
+ <real value="1296" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
- <string key="IBCocoaTouchPluginVersion">933</string>
+ <string key="IBCocoaTouchPluginVersion">1181</string>
</data>
</archive>

0 comments on commit fc391e9

Please sign in to comment.