Tag: ios

Top space on device rotation

I have the following constraints on my UIView in portrait mode: And landscape: This is screenshot of the ViewController when I open it first time: Top space is OK. Then I’m rotating the device to landscape: Do you see that white space on the top? And when I’m rotating it back to landscape, the space […]

Works on iOS Simulator but not on iPhone

The line of code works fine on the iOS Simulator 6.0, but is crashing when I try to run it on my iPhone, also running iOS6. [menuView addSubview:mvc.view]; Why is this happening, and how can I fix it? This is the more complete version of the code: SDMenuViewController *mvc = [[SDMenuViewController alloc] init]; [menuView addSubview:mvc.view]; […]

Objective-C Defining a Global Array for use by several ViewControllers

I’ve been trying to implement a global NSMutableArray from what I think to be a singleton class that I’ve implemented. I can enter ViewController # 2, add and remove objects to the array. However, when I leave ViewController #2 and come back, the data does not persist, and I have an array with 0 objects. […]

how to return result after OpenWithCompletionHandler: is complete

Want to query a photo in the Coredata database this is my code this is the NSObjectSubclass category //Photo+creak.h #import “Photo+creat.h” @implementation Photo (creat) +(Photo *)creatPhotoByString:(NSString *)photoName inManagedObjectContext:(NSManagedObjectContext *)context{ Photo *picture = nil; NSFetchRequest *request = [NSFetchRequest fetchRequestWithEntityName:@”Photo”]; request.predicate = [NSPredicate predicateWithFormat:@”name = %@”, photoName]; NSArray *matches = [context executeFetchRequest:request error:nil]; if (!matches || [matches […]

Making table view section expand swift

I am following this tutorial for expanding and collapsing my table view section. As this demo is done in swift 2.2 I have made all the changes according to swift 3.0 . I am stuck at the below function at if condition(currentSectionCells[row][“isVisible”]) which gives me error as “Type ‘NSFastEnumerationIterator.Element’ (aka ‘Any’ has no subscript members)’”. […]

iOS: Auto Layout: Two buttons side-by-side when there's enough space, otherwise on top of one another

Looking for an auto layout solution where two buttons lie side-by-side when there is enough space to do so, but otherwise (when the view is displayed with limited width) rest on top of one another. I don’t even know where to begin to think this through with auto layout. Any help is appreciated!

Xcode iOS Simulator does not load new project

I was working on an iOS app in xCode and I was perfectly using the simulator. Yesterday I had to create a new project and after putting some code I found out that when clicking Run, the app compiles, links, but then the simulator never starts. And stop is disabled. I tried with both iOS […]

weak vs strong pointers behaving slightly differently in xcode 5

i have some code that was working happily in xcode 4.6. since i upgraded to xcode 5 one section was not working. it’s not erroring. very oddly the exact same code with no modifications DOES work in the simulators, but does NOT work on devices. if i compile the same coe in xcode 4.6 it […]

Trying to push to detail view with Xcode 4.2 iOS 5 from UIWebView

I have a ViewController embedded in a NavigationController. The ViewController has a UIWebView that I’m trying to capture links from. I’m able to intercept the links, but when I try to push the link content to a detail page, it seems to be firing a new Controller but it’s invisible. If I click a link […]

name of the picked image xcode

I want to get the name of the image picked from the library or newly clicked in – -(void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info I am using this code: -(void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeSavedPhotosAlbum]) { AppDelegate *del = [[UIApplication sharedApplication]delegate]; [self dismissModalViewControllerAnimated:YES]; image = [info objectForKey:UIImagePickerControllerOriginalImage]; NSLog(@”imagekbgfg=====>%@”,image); [self.imageView setImage:image]; imgName = […]