mainbar: add selected bar

This commit is contained in:
Gautier Pelloux-Prayer 2015-07-31 17:00:59 +02:00
parent 4cfbab8019
commit ac92a40ed3
3 changed files with 21 additions and 9 deletions

View file

@ -16,6 +16,7 @@
<outlet property="historyNotificationLabel" destination="34" id="35"/>
<outlet property="historyNotificationView" destination="32" id="36"/>
<outlet property="portraitView" destination="3" id="43"/>
<outlet property="selectedBtnView" destination="Aqd-gD-0a2" id="drm-pL-5S6"/>
<outlet property="view" destination="3" id="14"/>
</connections>
</placeholder>
@ -24,7 +25,7 @@
<rect key="frame" x="0.0" y="0.0" width="360" height="63"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="6" userLabel="history" customClass="UIIconButton">
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="6" userLabel="historyButton" customClass="UIIconButton">
<rect key="frame" x="0.0" y="0.0" width="90" height="63"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" label="History"/>
@ -34,7 +35,7 @@
<action selector="onHistoryClick:" destination="-1" eventType="touchUpInside" id="22"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="8" userLabel="contacts" customClass="UIIconButton">
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="8" userLabel="contactsButton" customClass="UIIconButton">
<rect key="frame" x="90" y="0.0" width="90" height="63"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" label="Contacts"/>
@ -48,7 +49,7 @@
<action selector="onContactsClick:" destination="-1" eventType="touchUpInside" id="23"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="7" userLabel="dialer" customClass="UIIconButton">
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="7" userLabel="dialerButton" customClass="UIIconButton">
<rect key="frame" x="180" y="0.0" width="90" height="63"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" label="Dialer"/>
@ -58,7 +59,7 @@
<action selector="onDialerClick:" destination="-1" eventType="touchUpInside" id="24"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="5" userLabel="chat" customClass="UIIconButton">
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="5" userLabel="chatButton" customClass="UIIconButton">
<rect key="frame" x="270" y="0.0" width="90" height="63"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" label="Chat"/>
@ -69,6 +70,11 @@
<action selector="onChatClick:" destination="-1" eventType="touchUpInside" id="26"/>
</connections>
</button>
<view contentMode="scaleToFill" id="Aqd-gD-0a2" userLabel="selectedBtnView">
<rect key="frame" x="180" y="60" width="90" height="3"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="0.36862745099999999" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
<view autoresizesSubviews="NO" userInteractionEnabled="NO" contentMode="scaleToFill" id="37" userLabel="chatNotificationView">
<rect key="frame" x="338" y="0.0" width="21" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
@ -115,7 +121,7 @@
<color key="backgroundColor" red="0.2666666667" green="0.2666666667" blue="0.2666666667" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="401" y="264.5"/>
<point key="canvasLocation" x="209" y="259.5"/>
</view>
</objects>
<resources>

View file

@ -26,17 +26,16 @@
@property (nonatomic, strong) IBOutlet UIButton* historyButton;
@property (nonatomic, strong) IBOutlet UIButton* contactsButton;
@property (nonatomic, strong) IBOutlet UIButton* dialerButton;
@property (nonatomic, strong) IBOutlet UIButton* settingsButton;
@property (nonatomic, strong) IBOutlet UIButton* chatButton;
@property (nonatomic, strong) IBOutlet UIView *historyNotificationView;
@property (nonatomic, strong) IBOutlet UILabel *historyNotificationLabel;
@property (nonatomic, strong) IBOutlet UIView *chatNotificationView;
@property (nonatomic, strong) IBOutlet UILabel *chatNotificationLabel;
@property(weak, nonatomic) IBOutlet UIView *selectedBtnView;
-(IBAction) onHistoryClick: (id) event;
-(IBAction) onContactsClick: (id) event;
-(IBAction) onDialerClick: (id) event;
-(IBAction) onSettingsClick: (id) event;
-(IBAction) onChatClick: (id) event;
@end

View file

@ -30,7 +30,6 @@ static NSString *const kDisappearAnimation = @"disappear";
@synthesize historyButton;
@synthesize contactsButton;
@synthesize dialerButton;
@synthesize settingsButton;
@synthesize chatButton;
@synthesize historyNotificationView;
@synthesize historyNotificationLabel;
@ -222,8 +221,16 @@ static NSString *const kDisappearAnimation = @"disappear";
historyButton.selected = [view equal:[HistoryViewController compositeViewDescription]];
contactsButton.selected = [view equal:[ContactsViewController compositeViewDescription]];
dialerButton.selected = [view equal:[DialerViewController compositeViewDescription]];
settingsButton.selected = [view equal:[SettingsViewController compositeViewDescription]];
chatButton.selected = [view equal:[ChatViewController compositeViewDescription]];
CGRect selectedNewFrame = _selectedBtnView.frame;
selectedNewFrame.origin.x =
(historyButton.selected
? historyButton.frame.origin.x
: (contactsButton.selected
? contactsButton.frame.origin.x
: (dialerButton.selected ? dialerButton.frame.origin.x
: (chatButton.selected ? chatButton.frame.origin.x : 0))));
_selectedBtnView.frame = selectedNewFrame;
}
#pragma mark - Action Functions