This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSArray *punctuationMarks = [NSArray arrayWithObjects:@".",@",",@"\"",@";",@":",@"!", @"“", @"”", @"?", @"!" , nil]; | |
NSMutableString *mutableWordString = [wordDescriptor.wordString mutableCopy]; | |
for(NSString *punctuationMark in punctuationMarks) { | |
NSUInteger offset = 0; | |
while (true) { | |
NSRange rangeOfThatPunctuationMark = [mutableWordString rangeOfString:punctuationMark options:NSCaseInsensitiveSearch range:NSMakeRange(offset, mutableWordString.length - offset)]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wordDescriptor.wordString = [wordDescriptor.wordString stringByReplacingOccurrencesOfString:@"." withString:@"<span class='punctuation'>.</span>"]; | |
wordDescriptor.wordString = [wordDescriptor.wordString stringByReplacingOccurrencesOfString:@"," withString:@"<span class='punctuation'>,</span>"]; | |
wordDescriptor.wordString = [wordDescriptor.wordString stringByReplacingOccurrencesOfString:@"\"" withString:@"<span class='punctuation'>\"</span>"]; | |
wordDescriptor.wordString = [wordDescriptor.wordString stringByReplacingOccurrencesOfString:@";" withString:@"<span class='punctuation'>;</span>"]; | |
wordDescriptor.wordString = [wordDescriptor.wordString stringByReplacingOccurrencesOfString:@":" withString:@"<span class='punctuation'>:</span>"]; | |
wordDescriptor.wordString = [wordDescriptor.wordString stringByReplacingOccurrencesOfString:@"!" withString:@"<span class='punctuation'>!</span>"]; | |
wordDescriptor.wordString = [wordDescriptor.wordString stringByReplacingOccurrencesOfString:@"“" withString:@" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"BackButtonTitle", nil) | |
style:UIBarButtonItemStyleBordered | |
target:nil | |
action:nil]; | |
[self.navigationItem setBackBarButtonItem:backItem]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void) animateWordMeaningLabelToLefttAndUpdateRepetitionOnCompletion { | |
CGRect orginalPlaceOfWordMeaningLabel = self.wordMeaningLabel.frame; | |
[UIView animateWithDuration:0.5 animations:^{ // TODO magic number | |
CGRect frame = self.wordMeaningLabel.frame; | |
frame.origin.x = -self.wordMeaningLabel.frame.size.width; | |
self.wordMeaningLabel.frame = frame; | |
self.wordMeaningLabel.layer.backgroundColor = [self.crossContainer.backgroundColor colorWithAlphaComponent:1].CGColor; | |
self.crossContainer.layer.backgroundColor = [self.crossContainer.backgroundColor colorWithAlphaComponent:1].CGColor; | |
self.wordMeaningLableIsAnimating = YES; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void) pan:(UIPanGestureRecognizer *)recognizer { | |
CGPoint translation = [recognizer translationInView:self.view]; | |
recognizer.view.center = CGPointMake(recognizer.view.center.x + translation.x, | |
recognizer.view.center.y + translation.y); | |
NSLog(@"translationInView %@", NSStringFromCGPoint(translation)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// TwigitSentenceDescriptor.m | |
// Twigit | |
// | |
// Created by Paweł Brewczyński on 3/12/14. | |
// Copyright (c) 2014 Paweł Brewczyński. All rights reserved. | |
// | |
#import "TwigitSentenceDescriptor.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[textView.textStorage beginEditing]; | |
[textView.textStorage addAttribute:NSFontAttributeName value: [UIFont fontWithDescriptor:[[ft fontDescriptor] fontDescriptorWithSymbolicTraits:UIFontDescriptorTraitBold] size:20] range:range]; | |
[textView.textStorage endEditing]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "TwigitViewController.h" | |
@interface TwigitViewController () | |
@property (strong, nonatomic) UIView *container; | |
@property (strong, nonatomic) UIView *v1; | |
@property (nonatomic) NSInteger y; | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_myContainer = [[UILabel alloc] initWithFrame:frame]; | |
_myContainer.backgroundColor = [UIColor greenColor]; | |
[self.view addSubview:_myContainer]; | |
UIView *subview = [[UIView alloc] initWithFrame:_myContainer.bounds]; | |
subview.backgroundColor = [UIColor yellowColor]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_myContainer = [[UILabel alloc] initWithFrame:frame]; | |
_myContainer.backgroundColor = [UIColor greenColor]; | |
[self.view addSubview:_myContainer]; | |
UIView *subview = [[UIView alloc] initWithFrame:_myContainer.bounds]; | |
subview.backgroundColor = [UIColor yellowColor]; |