Tag: iphone

How to gain assignment access to CGRect elements when the CGRect is an instance variable

@interface some_class : some_parent { } @property (nonatomic, assign) CGRect the_rect; @end … @implementation some_class @synthesize the_rect; @end After creating an instance of some_class: instance_of_some_class.the_rect.origin.x = 0.0; Which generates an “Expression not assignable” error. Of course this works fine: instance_of_some_class.the_rect = CGRectMake(0,0,0,0); I guess the problem is that the auto-magically created setter only knows about […]

iPhone UITableView Sections

I have been programming a UITableView and each cells pushes a new view, All I Want to do is add two new sections one male and one female, first and second voice need to be in the male section and the third voice needs to be in the female section. #import “FirstLevelViewController.h” #import “SecondLevelViewController.h” #import […]

What is the proper way to avoid Retain Cycle while using blocks

What is the proper way to add objects in NSMutableArray which is strongly defined by property. [tapBlockView setTapBlock:^(UIImage* image) { [self.myImageArray addObject:image]; // self retain cycle } If I will create weak reference something like __weak NSMutableArray *array = self.myImageArray; [tapBlockView setTapBlock:^(UIImage* image) { [array addObject:image]; // If I will do this then how will […]

Using Non-ARC Code in an ARC-Enabled Project – Adding Facebook

When i created my project, i made it to support ARC, so my project will support iOS 4.3 and above. Now i need to integrate Twitter and Facebook to it. Both Facebook and Twitter frameworks given by the companies does not support ARC. Most of the files have dealloc, and released its variables. Some say […]

Set UITableView Delegate and DataSource

This is my problem: I have this small UITableView in my storyboard: And this is my code: SmallTableViewController.h #import <UIKit/UIKit.h> #import “SmallTable.h” @interface SmallViewController : UIViewController @property (weak, nonatomic) IBOutlet UITableView *myTable; @end SmallTableViewController.m #import “SmallViewController.h” @interface SmallViewController () @end @implementation SmallViewController @synthesize myTable = _myTable; – (void)viewDidLoad { SmallTable *myTableDelegate = [[SmallTable alloc] init]; […]

Text selection on PDF after rendering using the drawLayer for ipad

I’m trying to highlight the text on the pdf after rendering on the ipad.I feel I’m achieving something with a lot of googling and the sample code provided by fastPdfKit. From this link I am parsing a pdf easily and trying to highlight text from a user search. I am using the below method to […]

I get error 0x8badf00d in iPhone app, and is not the usual suspect

I have a random crash in my app in launching. I’m pretty sure is not the launching time (as explained in What does 8badf00d mean?) because the app launch fast. The worst is that the crash log can’t be simbolicate (I can’t get the sourcecode line numbers). This is the error: Exception Type: 00000020 Exception […]

NSFetchedResultsController custom sort not getting called

I am currently trying to populate a UITableView in my project from Core Data using NSFetchedResultsController. I am using a custom search with a comparator (although I have also tried a selector and had an identical problem): if (fetchedResultsController != nil) { return fetchedResultsController; } /* Set up the fetched results controller. */ // Create […]

Possible to save an integer array using NSUserDefaults on iPhone?

Is it possible to save an integer array using NSUserDefaults on the iPhone? I have an array declared in my .h file as: int playfield[9][11] that gets filled with integers from a file and determines the layout of a game playfield. I want to be able to have several save slots where users can save […]

how to programmatically open the WIFI settings in objective c in iOS9

I’m trying to access the WIFI settings through my application using Objective-C. But can not find any way. Could someone help me? Already tested with: [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@”prefs:root=WIFI”]]; Does not work on iOS 9.