Skip to content

Instantly share code, notes, and snippets.

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)];
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:@"
UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"BackButtonTitle", nil)
style:UIBarButtonItemStyleBordered
target:nil
action:nil];
[self.navigationItem setBackBarButtonItem:backItem];
- (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;
- (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));
//
// TwigitSentenceDescriptor.m
// Twigit
//
// Created by Paweł Brewczyński on 3/12/14.
// Copyright (c) 2014 Paweł Brewczyński. All rights reserved.
//
#import "TwigitSentenceDescriptor.h"
[textView.textStorage beginEditing];
[textView.textStorage addAttribute:NSFontAttributeName value: [UIFont fontWithDescriptor:[[ft fontDescriptor] fontDescriptorWithSymbolicTraits:UIFontDescriptorTraitBold] size:20] range:range];
[textView.textStorage endEditing];
#import "TwigitViewController.h"
@interface TwigitViewController ()
@property (strong, nonatomic) UIView *container;
@property (strong, nonatomic) UIView *v1;
@property (nonatomic) NSInteger y;
@end
_myContainer = [[UILabel alloc] initWithFrame:frame];
_myContainer.backgroundColor = [UIColor greenColor];
[self.view addSubview:_myContainer];
UIView *subview = [[UIView alloc] initWithFrame:_myContainer.bounds];
subview.backgroundColor = [UIColor yellowColor];
_myContainer = [[UILabel alloc] initWithFrame:frame];
_myContainer.backgroundColor = [UIColor greenColor];
[self.view addSubview:_myContainer];
UIView *subview = [[UIView alloc] initWithFrame:_myContainer.bounds];
subview.backgroundColor = [UIColor yellowColor];