Merge roomDetailsViewController

Tapping on the room title view opens a dedicated viewcontroller.

It only updates the room name and the topic.
This commit is contained in:
yannick
2015-11-23 17:41:32 +00:00
21 changed files with 813 additions and 42 deletions
BIN
View File
Binary file not shown.
+4
View File
@@ -85,6 +85,10 @@
"settings_title_config" = "Configuration";
"settings_clear_cache" = "Clear cache";
// Room Details
"room_details_room_name" = "Room Name";
"room_details_topic" = "Topic";
"notification_settings_global_notification_settings" = "Global Notification Settings";
// Media picker
+13 -4
View File
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9059" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="H1p-Uh-vWS">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8191" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="H1p-Uh-vWS">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9049"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
</dependencies>
<scenes>
<!--RecentsNav-->
@@ -47,6 +47,7 @@
<outlet property="settingsMenuButton" destination="LzI-qU-WEx" id="dlp-Uc-6YU"/>
<outlet property="settingsMenuLabel" destination="vOA-DR-q63" id="M5D-fX-cTx"/>
<segue destination="y7N-Cs-bXh" kind="show" identifier="showRoomParticipants" id="2sI-aY-muu"/>
<segue destination="e7G-NU-7ck" kind="show" identifier="showRoomDetails" id="vCz-dl-6xQ"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="94y-cU-qQD" userLabel="First Responder" sceneMemberID="firstResponder"/>
@@ -255,7 +256,15 @@
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Exe-4N-jYR" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2271" y="-1063"/>
<point key="canvasLocation" x="3259" y="-1463"/>
</scene>
<!--Room Details View Controller-->
<scene sceneID="NZu-Q0-P0z">
<objects>
<tableViewController id="e7G-NU-7ck" customClass="RoomDetailsViewController" sceneMemberID="viewController"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="fXh-hO-Zgf" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="3254" y="-755"/>
</scene>
<!--Authentication View Controller-->
<scene sceneID="FoA-N2-3aF">
@@ -467,7 +476,7 @@
<image name="settings.png" width="16" height="16"/>
</resources>
<inferredMetricsTieBreakers>
<segue reference="0ws-cL-0tk"/>
<segue reference="vqM-5M-ctF"/>
<segue reference="Vo4-8x-dtH"/>
</inferredMetricsTieBreakers>
</document>
@@ -0,0 +1,22 @@
/*
Copyright 2014 OpenMarket Ltd
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
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.
*/
#import <MatrixKit/MatrixKit.h>
@interface RoomDetailsViewController : MXKRoomDetailsViewController<UITextViewDelegate>
@end
@@ -0,0 +1,412 @@
/*
Copyright 2014 OpenMarket Ltd
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
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.
*/
#import "RoomDetailsViewController.h"
#import "TableViewCellWithLabelAndTextField.h"
#import "TableViewCellWithLabelAndLargeTextView.h"
#import "TableViewCellSeparator.h"
#import "RageShakeManager.h"
#define ROOM_SECTION 0
#define ROOM_SECTION_NAME 0
#define ROOM_SECTION_TOPIC 1
#define ROOM_SECTION_COUNT 2
#define ROOM_TOPIC_CELL_HEIGHT 99
@interface RoomDetailsViewController ()
{
// updated user data
NSMutableDictionary<NSString*, id> *updatedItems;
// active items
UITextView* topicTextView;
UITextField* nameTextField;
// pending http operation
MXHTTPOperation* pendingOperation;
}
@end
@implementation RoomDetailsViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// TODO use a color panel
// not an hard coded one.
CGFloat item = (242.0f / 255.0);
self.tableView.backgroundColor = [UIColor colorWithRed:item green:item blue:item alpha:item];
self.tableView.separatorColor = [UIColor clearColor];
// Setup `RoomDetailsViewController` properties
self.rageShakeManager = [RageShakeManager sharedManager];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didMXSessionStateChange:) name:kMXSessionStateDidChangeNotification object:nil];
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
[self dismissFirstResponder];
[[NSNotificationCenter defaultCenter] removeObserver:self name:kMXSessionStateDidChangeNotification object:nil];
}
- (void)destroy
{
self.navigationItem.rightBarButtonItem.enabled = NO;
if (pendingOperation)
{
[pendingOperation cancel];
pendingOperation = nil;
}
[super destroy];
}
#pragma mark - private
- (NSMutableDictionary*)getUpdatedItems
{
if (!updatedItems)
{
updatedItems = [[NSMutableDictionary alloc] init];
}
return updatedItems;
}
- (void)dismissFirstResponder
{
if ([topicTextView isFirstResponder])
{
[topicTextView resignFirstResponder];
}
if ([nameTextField isFirstResponder])
{
[nameTextField resignFirstResponder];
}
}
- (void)showUpdatingSpinner
{
// TODO : wait that we have the final behaviour
self.view.alpha = 0.5f;
self.view.userInteractionEnabled = NO;
}
- (void)hideUpdatingSpinner
{
// TODO : wait that we have the final behaviour
self.view.alpha = 1.0f;
self.view.userInteractionEnabled = YES;
}
#pragma mark - actions
- (void)textViewDidChange:(UITextView *)textView
{
// avoid nil pointer
NSString* text = (textView.text) ? textView.text : @"";
if (topicTextView == textView)
{
[[self getUpdatedItems] setObject:text forKey:@"ROOM_SECTION_TOPIC"];
}
}
- (IBAction)onTextFieldUpdate:(UITextField*)textField
{
// avoid nil pointer
NSString* text = (textField.text) ? textField.text : @"";
if (nameTextField == textField)
{
[[self getUpdatedItems] setObject:text forKey:@"ROOM_SECTION_NAME"];
}
}
- (void)didMXSessionStateChange:(NSNotification *)notif
{
// Check this is our Matrix session that has changed
if (notif.object == self.session)
{
// refresh when the session sync is done.
if (MXSessionStateRunning == self.session.state)
{
[self.tableView reloadData];
}
}
}
- (IBAction)onDone:(id)sender
{
// check if there is some update
if (mxRoomState && updatedItems && (updatedItems.count > 0))
{
// has a new room name
if ([updatedItems objectForKey:@"ROOM_SECTION_NAME"])
{
NSString* newName = [updatedItems objectForKey:@"ROOM_SECTION_NAME"];
if (![newName isEqualToString:mxRoomState.name])
{
[self showUpdatingSpinner];
__weak typeof(self) weakSelf = self;
pendingOperation = [mxRoom setName:newName success:^{
__strong __typeof(weakSelf)strongSelf = weakSelf;
strongSelf->pendingOperation = nil;
[strongSelf->updatedItems removeObjectForKey:@"ROOM_SECTION_NAME"];
[strongSelf onDone:nil];
} failure:^(NSError *error) {
__strong __typeof(weakSelf)strongSelf = weakSelf;
// TODO should stop the saving ?
// continue the saving by now
strongSelf->pendingOperation = nil;
[strongSelf->updatedItems removeObjectForKey:@"ROOM_SECTION_NAME"];
[strongSelf onDone:nil];
NSLog(@"[onDone] Rename room failed: %@", error);
}];
return;
}
}
// has a new room topic
if ([updatedItems objectForKey:@"ROOM_SECTION_TOPIC"])
{
NSString* newTopic = [updatedItems objectForKey:@"ROOM_SECTION_TOPIC"];
if (![newTopic isEqualToString:mxRoomState.topic])
{
[self showUpdatingSpinner];
__weak typeof(self) weakSelf = self;
pendingOperation = [mxRoom setTopic:newTopic success:^{
__strong __typeof(weakSelf)strongSelf = weakSelf;
strongSelf->pendingOperation = nil;
[strongSelf->updatedItems removeObjectForKey:@"ROOM_SECTION_TOPIC"];
[strongSelf onDone:nil];
} failure:^(NSError *error) {
__strong __typeof(weakSelf)strongSelf = weakSelf;
// TODO should stop the saving ?
// continue the saving by now
strongSelf->pendingOperation = nil;
[strongSelf->updatedItems removeObjectForKey:@"ROOM_SECTION_TOPIC"];
[strongSelf onDone:nil];
NSLog(@"[onDone] Rename topic failed: %@", error);
}];
return;
}
}
}
[self hideUpdatingSpinner];
[self.navigationController popViewControllerAnimated:YES];
}
#pragma mark - UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (section == ROOM_SECTION)
{
// add separators
return ROOM_SECTION_COUNT * 2 + 1;
}
return 0;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 33.0f;
}
- (UITableViewHeaderFooterView *)headerViewForSection:(NSInteger)section
{
UITableViewHeaderFooterView *header = [[UITableViewHeaderFooterView alloc] initWithFrame:CGRectMake(0, 0, 10, 33)];
header.backgroundColor = [UIColor redColor];
return header;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section == ROOM_SECTION)
{
NSInteger row = indexPath.row;
// is a separator ?
if ((row % 2) == 0)
{
return 1.0f;
}
// retrieve row as a ROOM_SECTION_XX index
row = (row - 1) / 2;
if (row == ROOM_SECTION_TOPIC)
{
return ROOM_TOPIC_CELL_HEIGHT;
}
}
return [super tableView:tableView heightForRowAtIndexPath:indexPath];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSInteger row = indexPath.row;
UITableViewCell* cell = nil;
// general settings
if (indexPath.section == ROOM_SECTION)
{
if ((row % 2) == 0)
{
UITableViewCell* sepCell = [tableView dequeueReusableCellWithIdentifier:[TableViewCellSeparator defaultReuseIdentifier]];
if (!sepCell)
{
sepCell = [[TableViewCellSeparator alloc] init];
}
// the borders are drawn in dark grey
sepCell.contentView.backgroundColor = ((row == 0) || (row == ROOM_SECTION_COUNT * 2)) ? [UIColor darkGrayColor] : [UIColor lightGrayColor];
return sepCell;
}
// retrieve row as a ROOM_SECTION_XX index
row = (row - 1) / 2;
if (row == ROOM_SECTION_TOPIC)
{
TableViewCellWithLabelAndLargeTextView *roomTopicCell = [tableView dequeueReusableCellWithIdentifier:[TableViewCellWithLabelAndLargeTextView defaultReuseIdentifier]];
if (!roomTopicCell)
{
roomTopicCell = [[TableViewCellWithLabelAndLargeTextView alloc] init];
// define the cell height
CGRect frame = roomTopicCell.frame;
frame.size.height = ROOM_TOPIC_CELL_HEIGHT;
roomTopicCell.frame = frame;
}
roomTopicCell.mxkLabel.text = NSLocalizedStringFromTable(@"room_details_topic", @"Vector", nil);
topicTextView = roomTopicCell.mxkTextView;
if (updatedItems && [updatedItems objectForKey:@"ROOM_SECTION_TOPIC"])
{
roomTopicCell.mxkTextView.text = (NSString*)[updatedItems objectForKey:@"ROOM_SECTION_TOPIC"];
}
else
{
roomTopicCell.mxkTextView.text = mxRoomState.topic;
}
roomTopicCell.mxkTextView.delegate = self;
// disable the edition if the user cannoy update it
roomTopicCell.mxkTextView.editable = isSuperUser;
roomTopicCell.mxkTextView.textColor = isSuperUser ? [UIColor blackColor] : [UIColor lightGrayColor];
cell = roomTopicCell;
}
else if (row == ROOM_SECTION_NAME)
{
TableViewCellWithLabelAndTextField *roomNameCell = [tableView dequeueReusableCellWithIdentifier:[TableViewCellWithLabelAndTextField defaultReuseIdentifier]];
if (!roomNameCell)
{
roomNameCell = [[TableViewCellWithLabelAndTextField alloc] init];
}
roomNameCell.mxkLabel.text = NSLocalizedStringFromTable(@"room_details_room_name", @"Vector", nil);
roomNameCell.mxkTextField.userInteractionEnabled = YES;
if (updatedItems && [updatedItems objectForKey:@"ROOM_SECTION_NAME"])
{
roomNameCell.mxkTextField.text = (NSString*)[updatedItems objectForKey:@"ROOM_SECTION_NAME"];
}
else
{
roomNameCell.mxkTextField.text = mxRoomState.name;
}
roomNameCell.accessoryType = UITableViewCellAccessoryNone;
cell = roomNameCell;
nameTextField = roomNameCell.mxkTextField;
// disable the edition if the user cannoy update it
roomNameCell.editable = isSuperUser;
roomNameCell.mxkTextField.textColor = isSuperUser ? [UIColor blackColor] : [UIColor lightGrayColor];
// Add a "textFieldDidChange" notification method to the text field control.
[roomNameCell.mxkTextField addTarget:self action:@selector(onTextFieldUpdate:) forControlEvents:UIControlEventEditingChanged];
}
}
return cell;
}
- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (self.tableView == aTableView)
{
[self dismissFirstResponder];
}
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
if (scrollView == self.tableView)
{
[self dismissFirstResponder];
}
}
@end
@@ -23,6 +23,8 @@
#import "RoomParticipantsViewController.h"
#import "RoomDetailsViewController.h"
@interface RoomViewController ()
{
// The constraint used to animate menu list display
@@ -301,6 +303,20 @@
participantsViewController.mxRoom = self.roomDataSource.room;
}
}
else if ([[segue identifier] isEqualToString:@"showRoomDetails"])
{
if ([pushedViewController isKindOfClass:[RoomDetailsViewController class]])
{
// Dismiss keyboard
[self dismissKeyboard];
RoomDetailsViewController* detailsViewController = (RoomDetailsViewController*)pushedViewController;
[detailsViewController initWithSession:self.roomDataSource.mxSession andRoomId:self.roomDataSource.roomId];
}
}
// Hide back button title
self.navigationItem.backBarButtonItem =[[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:nil];
}
#pragma mark - MXKRoomInputToolbarViewDelegate
@@ -386,6 +402,20 @@
[super tableView:tableView didSelectRowAtIndexPath:indexPath];
}
#pragma mark - RoomDetailsViewController management
- (BOOL)roomTitleViewShouldBeginEditing:(MXKRoomTitleView*)titleView
{
// instead of opening a text edition
// launch a dedicated viewcontroller.
dispatch_async(dispatch_get_main_queue(), ^{
[self performSegueWithIdentifier:@"showRoomDetails" sender:self];
});
// cancel any requested edition
return NO;
}
@end
BIN
View File
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,22 @@
/*
Copyright 2015 OpenMarket Ltd
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
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.
*/
#import "MXKTableViewCell.h"
@interface TableViewCellSeparator : MXKTableViewCell
@end
@@ -0,0 +1,21 @@
/*
Copyright 2015 OpenMarket Ltd
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
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.
*/
#import "TableViewCellSeparator.h"
@implementation TableViewCellSeparator
@end
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="8191" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" rowHeight="2" id="5Je-1y-foH" customClass="TableViewCellSeparator">
<rect key="frame" x="0.0" y="0.0" width="600" height="2"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="5Je-1y-foH" id="hCm-wd-Yup">
<rect key="frame" x="0.0" y="0.0" width="600" height="1"/>
<autoresizingMask key="autoresizingMask"/>
<color key="backgroundColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<color key="tintColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</tableViewCellContentView>
</tableViewCell>
</objects>
</document>
@@ -0,0 +1,26 @@
/*
Copyright 2015 OpenMarket Ltd
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
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.
*/
#import "MXKTableViewCell.h"
@interface TableViewCellWithLabelAndLargeTextView : MXKTableViewCell
{
}
@property (strong, nonatomic) IBOutlet UILabel *mxkLabel;
@property (strong, nonatomic) IBOutlet UITextView *mxkTextView;
@end
@@ -0,0 +1,35 @@
/*
Copyright 2015 OpenMarket Ltd
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
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.
*/
#import "TableViewCellWithLabelAndLargeTextView.h"
@implementation TableViewCellWithLabelAndLargeTextView
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self)
{
}
return self;
}
- (void)dealloc
{
}
@end
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="8191" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" rowHeight="99" id="5Je-1y-foH" customClass="TableViewCellWithLabelAndLargeTextView">
<rect key="frame" x="0.0" y="0.0" width="600" height="99"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="5Je-1y-foH" id="hCm-wd-Yup">
<rect key="frame" x="0.0" y="0.0" width="600" height="98"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="justified" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="584" translatesAutoresizingMaskIntoConstraints="NO" id="DE7-uC-Oz2">
<rect key="frame" x="10" y="8" width="45" height="21"/>
<color key="tintColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" text="a text" textAlignment="right" translatesAutoresizingMaskIntoConstraints="NO" id="6xh-yB-9FP" userLabel="Mxk TextView">
<rect key="frame" x="63" y="0.0" width="529" height="91"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textView>
</subviews>
<constraints>
<constraint firstItem="6xh-yB-9FP" firstAttribute="leading" secondItem="DE7-uC-Oz2" secondAttribute="trailing" constant="8" id="1S8-WD-YdX"/>
<constraint firstItem="DE7-uC-Oz2" firstAttribute="leading" secondItem="hCm-wd-Yup" secondAttribute="leading" constant="10" id="qse-r7-x6e"/>
</constraints>
</tableViewCellContentView>
<constraints>
<constraint firstItem="DE7-uC-Oz2" firstAttribute="top" secondItem="5Je-1y-foH" secondAttribute="top" constant="8" id="4gW-jW-XUX"/>
<constraint firstAttribute="bottom" secondItem="6xh-yB-9FP" secondAttribute="bottom" constant="8" id="Io9-HP-DJE"/>
<constraint firstItem="6xh-yB-9FP" firstAttribute="top" secondItem="5Je-1y-foH" secondAttribute="top" id="PqJ-jG-FUv"/>
<constraint firstAttribute="trailing" secondItem="6xh-yB-9FP" secondAttribute="trailing" constant="8" id="hIh-cS-5Lj"/>
</constraints>
<connections>
<outlet property="mxkLabel" destination="DE7-uC-Oz2" id="944-Ob-lSz"/>
<outlet property="mxkTextView" destination="6xh-yB-9FP" id="8FX-Mo-Dhp"/>
</connections>
</tableViewCell>
</objects>
</document>
@@ -0,0 +1,24 @@
/*
Copyright 2015 OpenMarket Ltd
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
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.
*/
#import "MXKTableViewCellWithLabelAndTextField.h"
@interface TableViewCellWithLabelAndTextField : MXKTableViewCellWithLabelAndTextField
// YES to allow text edition
@property (nonatomic) BOOL editable;
@end
@@ -0,0 +1,33 @@
/*
Copyright 2015 OpenMarket Ltd
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
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.
*/
#import "TableViewCellWithLabelAndTextField.h"
@implementation TableViewCellWithLabelAndTextField
#pragma mark - UITextField delegate
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
if (textField == self.mxkTextField)
{
return _editable;
}
return [super textFieldShouldBeginEditing:textField];
}
@end
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="8191" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="5Je-1y-foH" customClass="TableViewCellWithLabelAndTextField">
<rect key="frame" x="0.0" y="0.0" width="600" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="5Je-1y-foH" id="hCm-wd-Yup">
<rect key="frame" x="0.0" y="0.0" width="600" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="A text here" textAlignment="right" minimumFontSize="14" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="SBE-PS-i6p">
<rect key="frame" x="63" y="12" width="527" height="21"/>
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<textInputTraits key="textInputTraits" returnKeyType="done"/>
<connections>
<outlet property="delegate" destination="5Je-1y-foH" id="Nie-b5-gB9"/>
</connections>
</textField>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="justified" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="584" translatesAutoresizingMaskIntoConstraints="NO" id="DE7-uC-Oz2">
<rect key="frame" x="10" y="11" width="45" height="21"/>
<color key="tintColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="SBE-PS-i6p" secondAttribute="trailing" constant="10" id="7NM-6p-4fc"/>
<constraint firstItem="SBE-PS-i6p" firstAttribute="centerY" secondItem="DE7-uC-Oz2" secondAttribute="centerY" constant="0.5" id="LEG-PI-Zmz"/>
<constraint firstAttribute="centerY" secondItem="DE7-uC-Oz2" secondAttribute="centerY" id="PU3-ZA-23J"/>
<constraint firstItem="SBE-PS-i6p" firstAttribute="leading" secondItem="DE7-uC-Oz2" secondAttribute="trailing" constant="8" id="h1v-HS-kzp"/>
<constraint firstItem="DE7-uC-Oz2" firstAttribute="leading" secondItem="hCm-wd-Yup" secondAttribute="leading" constant="10" id="qse-r7-x6e"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="mxkLabel" destination="DE7-uC-Oz2" id="944-Ob-lSz"/>
<outlet property="mxkTextField" destination="SBE-PS-i6p" id="jLi-27-mbO"/>
</connections>
</tableViewCell>
</objects>
</document>