design ChatConversationCreateConfirmView

This commit is contained in:
Benjamin Reis 2017-10-05 15:17:26 +02:00
parent a96486f5be
commit fc7cf13fd2
5 changed files with 70 additions and 6 deletions

View file

@ -8,9 +8,10 @@
#import <UIKit/UIKit.h>
#import "UICompositeView.h"
@interface ChatConversationCreateConfirmView : UIViewController <UICompositeViewDelegate>
@interface ChatConversationCreateConfirmView : UIViewController <UICompositeViewDelegate, UITextFieldDelegate, UIGestureRecognizerDelegate, UICollectionViewDataSource>
@property (weak, nonatomic) IBOutlet UITextField *nameField;
@property (weak, nonatomic) IBOutlet UIIconButton *validateButton;
@property(nonatomic, strong) NSMutableDictionary *contacts;
- (IBAction)onBackClick:(id)sender;
- (IBAction)onValidateClick:(id)sender;

View file

@ -7,6 +7,7 @@
#import "ChatConversationCreateConfirmView.h"
#import "PhoneMainView.h"
#import "UIChatCreateConfirmCollectionViewCell.h"
@implementation ChatConversationCreateConfirmView
@ -31,7 +32,18 @@ static UICompositeViewDescription *compositeDescription = nil;
- (void)viewDidLoad {
[super viewDidLoad];
_validateButton.enabled = FALSE;
_nameField.delegate = self;
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]
initWithTarget:self
action:@selector(dismissKeyboards)];
tap.delegate = self;
[self.view addGestureRecognizer:tap];
}
- (void)dismissKeyboards {
if ([_nameField isFirstResponder]) {
[_nameField resignFirstResponder];
}
}
- (IBAction)onBackClick:(id)sender {
@ -40,4 +52,25 @@ static UICompositeViewDescription *compositeDescription = nil;
- (IBAction)onValidateClick:(id)sender {
}
#pragma mark - UITextFieldDelegate
- (void)textFieldDidEndEditing:(UITextField *)textField {
_validateButton.enabled = (textField.text.length > 0 && textField.text != nil && ![textField.text isEqual:@""]);
}
#pragma mark - UICollectionViewDataSource
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
return _contacts.count;
}
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
return 1;
}
- (UIChatCreateConfirmCollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
return NULL;
}
@end

View file

@ -65,15 +65,21 @@
</button>
</subviews>
</view>
<textField opaque="NO" clipsSubviews="YES" tag="100" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="Name this chatroom" borderStyle="roundedRect" textAlignment="center" adjustsFontSizeToFit="NO" minimumFontSize="10" translatesAutoresizingMaskIntoConstraints="NO" id="5uU-sb-Hle" userLabel="usernameField">
<rect key="frame" x="38" y="74" width="299" height="30"/>
<textField opaque="NO" clipsSubviews="YES" tag="100" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="Name this chatroom" borderStyle="roundedRect" textAlignment="center" adjustsFontSizeToFit="NO" minimumFontSize="10" translatesAutoresizingMaskIntoConstraints="NO" id="5uU-sb-Hle" userLabel="chatRoomNameField">
<rect key="frame" x="8" y="74" width="359" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="0.85415387149999999" green="0.85412830110000004" blue="0.85414278509999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<accessibility key="accessibilityConfiguration" label="Username"/>
<accessibility key="accessibilityConfiguration" label="ChatRoomName"/>
<color key="textColor" red="0.20521381499999999" green="0.20520767570000001" blue="0.2052111626" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<textInputTraits key="textInputTraits" autocorrectionType="no" returnKeyType="next"/>
<textInputTraits key="textInputTraits" autocorrectionType="no" returnKeyType="next" enablesReturnKeyAutomatically="YES"/>
</textField>
<view contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="vxZ-Pk-gLv" userLabel="addedContacts" customClass="UICollectionView">
<rect key="frame" x="8" y="112" width="359" height="439"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<accessibility key="accessibilityConfiguration" label="addedContacts"/>
</view>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>

View file

@ -0,0 +1,12 @@
//
// UIChatCreateConfirmCollectionViewCell.h
// linphone
//
// Created by REIS Benjamin on 05/10/2017.
//
#import <UIKit/UIKit.h>
@interface UIChatCreateConfirmCollectionViewCell : UICollectionViewCell
@end

View file

@ -0,0 +1,12 @@
//
// UIChatCreateConfirmCollectionViewCell.m
// linphone
//
// Created by REIS Benjamin on 05/10/2017.
//
#import "UIChatCreateConfirmCollectionViewCell.h"
@implementation UIChatCreateConfirmCollectionViewCell
@end