Tag: cocoa touch

How to delete single characters in an UITextView

I have an UITextView which is for instance 380 characters in length: NSLog(@”aTextView.text lenght %i”, aTextView.text.length); I now want to go through this text (backwards, char by char) and delete all characters which come before the last space (e.g. if the last words were “…this is an example”, it want to reduce the string to […]

CATransaction Not Animating

I’ve created a new View-based Application in XCode. In the ViewController, the only code that I’ve modified looks like this: – (void)viewDidLoad { [super viewDidLoad]; UIView *newView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)]; newView.backgroundColor = [UIColor redColor]; [self.view addSubview:newView]; [CATransaction begin]; [CATransaction setValue:[NSNumber numberWithFloat:0.5f] forKey:kCATransactionAnimationDuration]; newView.layer.frame = CGRectMake(20,20,220,220); [CATransaction commit]; } It should create […]

TBXML parsing complex xml into array

I have an xml response that i need to set into an array. The problem is i need to access each element and store it in an array so that i can use it for a tableview. <?xml version=”1.0″ encoding=”UTF-8″?> <Response xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=”http://schema.2sms.com/2.0/schema/0310_ResponseReportStandard.xsd” Version=”1.0″> <Error> <ErrorCode>00</ErrorCode> <ErrorReason>OK</ErrorReason> </Error> <ResponseData> <Identification> <UserID>jonathan.pink@2sms.com</UserID> </Identification> <Result>2 records were […]

please set CG_CONTEXT_SHOW_BACKTRACE environmental variable

Despite looking over more than 3 post (made in 2015) about this problem, non have solved mine. When ever I run, a simple, code to draw a line using UIBezierPath the program would return me this: : CGContextSetStrokeColorWithColor: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable. : CGContextSetFillColorWithColor: […]

UISearchBar does not display Cancel button when added as subview to UINavigationBar

I’m following the answer at https://stackoverflow.com/a/14235624/855680 to animate my UISearchBar which starts off with a smaller width, then expands to the full width of the iPhone screen when active. It expands as expected, except that the Cancel button does not appear at all. I’ve tried calling setShowsCancelButton:animated in both searchBarTextDidBeginEditing: and searchDisplayControllerWillBeginSearch:, but to no […]

How to get to “Manage Subscriptions” from my app

Is there any method to get to Manage Subscriptions in settings by clicking a button from my app??

Copy a file from iPhone sandbox to Desktop?

I am developing an iPhone app for uni and we create an sqlite database file within the iPhone’s sandbox directory. Our application writes internally to this file, I am wondering how it would be possible to get this file back to my desktop. I don’t really mind how it can be done, any way is […]

How do you get mutable dictionaries from AFNetworking and AFJSONRequestOperation?

I’m using JSONKit with AFNetworking’s AFHTTPClient (with AFJSONRequestOperation) and I can’t seem to figure out how one might trigger the use of the mutableObjectFrom… methods of JSONKit rather than the normal parser methods which return (or arrays of) JKDictionary. Is this possible without modifying AFNetworking?

NSMutableArray arrayWithArray: vs. initWithArray:

These both work in my app without any noticeable difference: 1) theArray = [[NSMutableArray alloc] initWithArray:[NSKeyedUnarchiver unarchiveObjectWithData:theData]]; 2) theArray = [NSMutableArray arrayWithArray:[NSKeyedUnarchiver unarchiveObjectWithData:theData]]; [theArray retain]; However, are they really equivalent? (1) has an alloc statement, whereas (2) does not. Is one preferable over the other?

Unbalanced calls to begin/end appearance transitions for <TSActivityMapVC: 0x81b1000>

When I init UITabBarController where each tab include UINavigationController and each UINavigationController include UIViewController when in UIViewController I do something like TSActivityDetailsVC * c = [[TSActivityDetailsVC alloc] initWithNibName:@”TSActivityDetailsVC” bundle:nil]; [self.navigationController pushViewController:c animated:YES]; I have animation, but when I press back button – I not have animation and get error Log: push view controller Unbalanced calls […]