cocoa-touch

get the UIImage (or CGImage) from drawRect

混江龙づ霸主 提交于 2020-01-06 18:07:07
问题 I'm calling the following code from drawRect - (void) drawPartial:(UIImage *)img colour:(UIColor *)colour { CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSaveGState(context); CGContextTranslateCTM(context, 0.0, self.bounds.size.height); CGContextScaleCTM(context, 1.0, -1.0); CGContextDrawImage(context, self.frame, img.CGImage); if (colour!=nil) { CGContextSetBlendMode (context, kCGBlendModeColor ); CGContextClipToMask(context, self.bounds, img.CGImage); CGContextSetFillColor

pass data to object of uiviewcontroller on iPhone

喜欢而已 提交于 2020-01-06 16:39:26
问题 I have an iPhone app with a tableviewcontroller. When you click a certain cell it opens a new uiviewcontroller with this code: nextViewController = [[avTouchViewController alloc] initWithNibName:@"avTouchViewController" bundle:nil]; The uiviewcontroller above called avTouchViewController has a property that looks like: IBOutlet SomeObject *controller; SomeObject is an object with all relevant view properties. I would like to pass an nsstring parameter from the tableviewcontroller I initialize

What about this custom uialertview?

谁说胖子不能爱 提交于 2020-01-06 15:38:28
问题 this is the code i have taken form..... - (void)willPresentAlertView:(UIAlertView *)alertView { [[[alertView subviews] objectAtIndex:2] setBackgroundColor:[UIColor colorWithRed:0.5 green:0.0f blue:0.0f alpha:1.0f]]; } - (void) presentSheet { UIAlertView *baseAlert = [[UIAlertView alloc] initWithTitle:@"Alert" message:@"This alert allows the user to choose between a 'safe' and a 'deadly' choice, indicated by button color.\n\n\n\n" delegate:self cancelButtonTitle:nil otherButtonTitles:@"Deadly!

GTMBase64 is missing in iOS

 ̄綄美尐妖づ 提交于 2020-01-06 14:53:15
问题 I have added GTMBase64.h and GTMBase64.m file into my project. However i can't use GTMBase64 in my code. It only show GTM_INLINE instead of GTMBase64 . Is there any framework i need to add to use GTMBase64 ? Thanks for any help. 回答1: I just got solution for my own question. Here is complete solution if you want to use GTMBase64 in your project. First download two GTMBase64.h and GTMBase64.m file. GTMBase64.h GTMBase64.m and download another file too. GTMDefines.h And then add these three

Obj-c, incorrect checksum for freed object - object was probably modified after being freed

☆樱花仙子☆ 提交于 2020-01-06 14:34:31
问题 I'm getting this error malloc: * * * error for object 0x8a591d4: incorrect checksum for freed object - object was probably modified after being freed. *** set a breakpoint in malloc_error_break to debug No memory available to program now: unsafe to call malloc No memory available to program now: unsafe to call malloc It comes from this line NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"Info" ofType:@"plist"]; NSData *plistData = [NSData dataWithContentsOfFile:plistPath];

iphone, understanding the view controller, presentModalViewController

不想你离开。 提交于 2020-01-06 14:28:34
问题 Thanks for all your help, as usual, i am looking for some more information... Regarding view controllers, i am trying to develop an application with multiple views. View Controller loads from View A using presentModalViewController - and loads View B from there - also works fine, but i have some nagging questions... View A has a table in it, which drills down to View B, and i can move back to view A usig dismissModalViewController, but once back in View A i can't access the table in View A.

UIRefreshControl without UITableViewController not calling selector

痞子三分冷 提交于 2020-01-06 13:29:37
问题 I have a UIViewController that has a UITableView as a subview. I am trying to add a pull-to-refresh on the table. Following some examples and discussions that I found here, I have the UIRefresh showing but it never calls the selector. I am not getting notified that the pull action happened. I cannot use a UITableViewController as my main controller as I need to add a fixed button at the bottom of the screen. I have the feeling I am missing something out that hopefully is obvious to someone

NSString In AQGridViewCell

有些话、适合烂在心里 提交于 2020-01-06 12:40:50
问题 I have an AQGridView set up to display the files in the documents directory along with 4 other documents that are predefined and loaded into the table at startup. I need to know how I can set the cell to hold the URL of the document (yes, even the predefined ones! They are all just NSStrings after all.) so it can be called later with - (void)gridView:(AQGridView *)gridView didSelectItemAtIndex:(NSUInteger)index { NSString *fileURL = [self._icons objectAtIndex:index]; // do stuff } and loaded

Passing variables through classes in Objective-C

时间秒杀一切 提交于 2020-01-06 10:12:45
问题 In my scenario I have 2 view controllers, one tied to the main view and one that is connected to the first one as a subview. Now let's say that my App Delegate class wants to pass a string to the subview controller. What is the best practice to achieve this? If I wanted to pass it to the 1st controller i could just say something like [self.firstController getStringInCustomFunction:[NSString stringWithFormat:@"200%d", 9]]; Also keep in mind that this call might have to be asynchronous. Coming

Passing variables through classes in Objective-C

夙愿已清 提交于 2020-01-06 10:12:38
问题 In my scenario I have 2 view controllers, one tied to the main view and one that is connected to the first one as a subview. Now let's say that my App Delegate class wants to pass a string to the subview controller. What is the best practice to achieve this? If I wanted to pass it to the 1st controller i could just say something like [self.firstController getStringInCustomFunction:[NSString stringWithFormat:@"200%d", 9]]; Also keep in mind that this call might have to be asynchronous. Coming