Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
14 changes: 9 additions & 5 deletions MATSOL/Classes/BaseConverterViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,19 @@
#import "Conversor.h"
#import "MATSOLDefines.h"

@interface CopyableLabel : UILabel

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think CopybleLabel should be in a separate module and it should be Copyable, there's a letter a missing. Tested this and it's working as expected.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the part of the separate module and I will consider it but I don't get the other part it says CopyableLabel all over

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably misread it, it's 2:53 on this side of the world :P

Yoshiki Vázquez-Baeza

On Sep 23, 2013, at 2:32 AM, Alejandro Paredes Alva notifications@github.com wrote:

In MATSOL/Classes/BaseConverterViewController.h:

@@ -10,15 +10,19 @@
#import "Conversor.h"
#import "MATSOLDefines.h"

+@interface CopyableLabel : UILabel
I understand the part of the separate module and I will consider it but I don't get the other part it says CopyableLabel all over


Reply to this email directly or view it on GitHub.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work, decide whether the separate module needs to be rewritten or if I should merge like this.


@end

typedef enum{
MBaseConverterButtonFrom=-1,
MBaseConverterButtonTo=-2,
MBaseConverterButtonDelete=-3
}MBaseConverterButton;

@interface BaseConverterViewController : UIViewController<UIActionSheetDelegate, UIPickerViewDelegate> {
IBOutlet UILabel *fromLabel;
IBOutlet UILabel *toLabel;
@interface BaseConverterViewController : UIViewController<UIActionSheetDelegate, UIPickerViewDelegate, UITextFieldDelegate> {
IBOutlet CopyableLabel *fromLabel;
IBOutlet CopyableLabel *toLabel;

IBOutlet UILabel *fromIndicator;
IBOutlet UILabel *toIndicator;
Expand All @@ -33,8 +37,8 @@ typedef enum{
}

@property (strong, nonatomic) IBOutlet UIImageView *backgroundImage;
@property (nonatomic, strong) IBOutlet UILabel *fromLabel;
@property (nonatomic, strong) IBOutlet UILabel *toLabel;
@property (nonatomic, strong) IBOutlet CopyableLabel *fromLabel;
@property (nonatomic, strong) IBOutlet CopyableLabel *toLabel;
@property (nonatomic, strong) IBOutlet UILabel *fromIndicator;
@property (nonatomic, strong) IBOutlet UILabel *toIndicator;
@property (nonatomic, strong) NSMutableArray *buttonsConverter;
Expand Down
46 changes: 44 additions & 2 deletions MATSOL/Classes/BaseConverterViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,47 @@

#import "BaseConverterViewController.h"

@implementation CopyableLabel
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender {
if(action == @selector(copy:)) {
return YES;
}
else {
return [super canPerformAction:action withSender:sender];
}
}

- (BOOL)canBecomeFirstResponder {
return YES;
}

- (BOOL)becomeFirstResponder {
if([super becomeFirstResponder]) {
return YES;
}
return NO;
}

- (void)copy:(id)sender {
UIPasteboard *board = [UIPasteboard generalPasteboard];
[board setString:self.text];
[self resignFirstResponder];
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
if([self isFirstResponder]) {
UIMenuController *menu = [UIMenuController sharedMenuController];
[menu setMenuVisible:NO animated:YES];
[menu update];
[self resignFirstResponder];
}
else if([self becomeFirstResponder]) {
UIMenuController *menu = [UIMenuController sharedMenuController];
[menu setTargetRect:self.bounds inView:self];
[menu setMenuVisible:YES animated:YES];
}
}
@end

@implementation BaseConverterViewController
@synthesize fromLabel;
Expand Down Expand Up @@ -123,12 +164,13 @@ - (void)viewDidLoad {

//Update the UI
[self lockButtons];

}



#pragma mark -
#pragma mark Buttons Utilities

-(void)typeStuff:(id)sender{
UIButton *whoAmI=(UIButton *)sender;

Expand Down
51 changes: 31 additions & 20 deletions MATSOL/Localization/en.lproj/BaseConverter.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="7.10">
<data>
<int key="IBDocument.SystemTarget">1536</int>
<string key="IBDocument.SystemVersion">12C60</string>
<string key="IBDocument.InterfaceBuilderVersion">2843</string>
<string key="IBDocument.AppKitVersion">1187.34</string>
<string key="IBDocument.HIToolboxVersion">625.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">1929</string>
<string key="NS.object.0">2083</string>
</object>
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
Expand Down Expand Up @@ -63,7 +63,6 @@
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">0</string>
<object class="NSColor" key="IBUITextColor" id="650872327">
Expand Down Expand Up @@ -96,10 +95,10 @@
<string key="NSFrame">{{16, 77}, {287, 33}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">0</string>
<reference key="IBUITextColor" ref="650872327"/>
Expand Down Expand Up @@ -301,11 +300,6 @@
</object>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">6</int>
<reference key="object" ref="836575903"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">12</int>
<reference key="object" ref="597621144"/>
Expand All @@ -321,6 +315,11 @@
<reference key="object" ref="486350126"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">6</int>
<reference key="object" ref="836575903"/>
<reference key="parent" ref="191373211"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
Expand All @@ -332,10 +331,12 @@
<string>-2.CustomClassName</string>
<string>-2.IBPluginDependency</string>
<string>1.IBPluginDependency</string>
<string>12.CustomClassName</string>
<string>12.IBPluginDependency</string>
<string>20.IBPluginDependency</string>
<string>21.IBPluginDependency</string>
<string>4.IBPluginDependency</string>
<string>6.CustomClassName</string>
<string>6.IBPluginDependency</string>
</object>
<object class="NSArray" key="dict.values">
Expand All @@ -345,10 +346,12 @@
<string>UIResponder</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>CopyableLabel</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>CopyableLabel</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
</object>
Expand All @@ -364,7 +367,7 @@
<reference key="dict.values" ref="0"/>
</object>
<nil key="sourceID"/>
<int key="maxID">25</int>
<int key="maxID">33</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
Expand Down Expand Up @@ -397,9 +400,9 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<string>UIImageView</string>
<string>UILabel</string>
<string>CopyableLabel</string>
<string>UILabel</string>
<string>UILabel</string>
<string>UILabel</string>
<string>CopyableLabel</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
Expand All @@ -424,15 +427,15 @@
</object>
<object class="IBToOneOutletInfo">
<string key="name">fromLabel</string>
<string key="candidateClassName">UILabel</string>
<string key="candidateClassName">CopyableLabel</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">toIndicator</string>
<string key="candidateClassName">UILabel</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">toLabel</string>
<string key="candidateClassName">UILabel</string>
<string key="candidateClassName">CopyableLabel</string>
</object>
</object>
</object>
Expand All @@ -441,20 +444,28 @@
<string key="minorKey">./Classes/BaseConverterViewController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">CopyableLabel</string>
<string key="superclassName">UILabel</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/CopyableLabel.h</string>
</object>
</object>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<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="1536" key="NS.object.0"/>
<real value="1552" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
<integer value="3000" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">1929</string>
<string key="IBCocoaTouchPluginVersion">2083</string>
</data>
</archive>
Loading