To Disable the subviews of ABNewPersonViewController's view in iOS7? - iphone

I want o make user interaction disable (not editable) for ABNewPersonViewController in iPhone by using the below code:
ABNewPersonViewController *newPersonVC;
newPersonVC = [[ABNewPersonViewController alloc] init];
newPersonVC.displayedPerson = newPerson;
[newPersonVC setNewPersonViewDelegate:_addressBookDelegator];
[self disableTableCells:[newPersonVC view]];
[[self navigationController] pushViewController:newPersonVC animated:YES];
The "disableTableCells" makes not editable to subviews of the "newPersonVC" view and I know the hierarchy is changed in iOS7,But I am not able to disable first,last name,photo and company name iOS7.
So the above code is working fine in iOS6 ,but not working in iOS7.

This is happening only with pushViewController ::--
[self disableTableCells:[newPersonVC view]];
[[self navigationController] pushViewController:newPersonVC animated:YES];
So I replaced the above lines with the following lines and "ABNewPersonViewController" view disable problem with iOS7 is fixed::
UINavigationController *navigation = [[UINavigationController alloc] initWithRootViewController:newPersonVC];
[self presentViewController:navigation animated:YES completion:^{
[self disableTableCells:[newPersonVC view]];
}];

Related

AQGridView - Orientation change in ExpanderDemo

I just started checking AQGridView and new to iOS too in the source example ExpanderDemo the orientation is working fine for the first View but as i click any cell and next upcomming AQGridView does not effect View on GridView.
ExpandingGridViewController *controller = [[ExpandingGridViewController alloc] init];
controller.gridView.frame = self.gridView.frame;
[self.gridView setHidden:YES];
[self.view.superview addSubview: controller.gridView];
[controller expandCellsFromRect: expandFromRect ofView: cell];
[controller viewDidAppear: NO];
On the other hand if i present the view controller to second it works fine with the orientation but losses the Animation for Expansion; which i don't want to loose. What should i do?
ExpandingGridViewController *controller = [[ExpandingGridViewController alloc] init];
[self presentViewController:controller animated:NO completion:nil];
The last time I use AQGridView I got a lot of troubles, I suggest You should give a try to UICollectionView. Cheers!

presenting a view not working in iphone

I am trying to navigate from one page to another on a button click in a facebook appliaction.
I am using
registerUser=[[RegisterPage alloc]initWithNibName:#"RegisterPage" bundle:nil];
[self presentModalViewController :registerUser animated:YES];
for presenting the next view after getting response from facebook.
But it is not showing the next view. It works fine in all other places where I used to present other views.
Anyone have idea about this issue?
What exactly is 'self' here? Is it a viewcontroller? Or just a UIView?
I think this'll only work if self is a viewcontroller or some subclass of it.
My code to present a view controller is somewhat like yours (without a nib):
ViewController *controller = [[ViewController alloc] initWithNibName:nil bundle:nil];
[controller setModalTransitionStyle:UIModalTransitionStyleCoverVertical];
[self presentModalViewController:controller animated:YES];
[controller release];
And to present a navigation controller it's like this (without a nib):
ViewController *controller = [[ViewController alloc] initWithNibName:nil bundle:nil];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:controller];
[navController setModalTransitionStyle:UIModalTransitionStyleCoverVertical];
[self presentModalViewController:navController animated:YES];
[navController release];
[controller release];
Sometimes simply copying someones code helps.
thanks for everyones reply.i have solved it after a long fight.i just dismissed the view before pesenting the next view and set dismissmodalviewcontrollerAnimated to NO.[self dismissModalViewControllerAnimated:NO];
nextview = [[LoginPage alloc]initWithNibName:#"LoginPage" bundle:nil];
[self presentModalViewController: nextview animated:YES];hope this help someone like me

Two UIViews for one ViewController

I'm not sure how to do this. So I originally had a ViewController that had one .xib, with one main view. I present it like this:
DogViewController *dvc = [[DogViewController alloc] initWithNibName:#"DogViewController" bundle:nil];
dvc.modalPresentationStyle = UIModalPresentationFormSheet;
dvc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:dvc animated:YES];
[dvc release];
So that works fine. However now from a button press in the DogViewController.xib, I want to dismiss the current form sheet, and show another form sheet with some additional questions before proceeding. So I started by adding another view to in my original .xib of DogViewController, then got stuck in the logic of how to dismiss the first one, and show the second one. I'm assuming I need some outlet to the new view in the same .xib, but from there I'm lost. Thanks.
The way to do this would be to set it up with a UINavigationController as Mathiew mentions. However, if you really want to transition between two views on one view controller, you can refer to this sample code from Apple:
http://developer.apple.com/library/ios/#samplecode/ViewTransitions/Introduction/Intro.html
The code uses ImageViews to demonstrate the effect but I don't see why you can't use views instead :)
You can add a view within the other view in front of all of the other objects and just use its hidden property to control whether it's shown or not.
Why don't you use a navigation controller in your modal view, create another xib and do a [self.navigationController pushViewController:secondViewController animated:YES];
If you have a good reason, you can set a second view outlet secondView and use code like
UIView* superview = [self.view superview];
[self.view removeFromSuperView];
[superview addSubview:self.secondView];
Very simple solution is to hold reference to MainViewController and call methods on it that swap between two view controllers.
Like this:
#implementation MainViewController
- (void)showDogViewController {
[self dismissModalViewControllerAnimated:YES];
DogViewController *dvc = [[DogViewController alloc] initWithNibName:#"DogViewController" bundle:nil];
dvc.modalPresentationStyle = UIModalPresentationFormSheet;
dvc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
dvc.mainViewController = self;
[self presentModalViewController:dvc animated:YES];
[dvc release];
}
- (void)showCatViewController {
[self dismissModalViewControllerAnimated:YES];
CatViewController *cvc = [[CatViewController alloc] initWithNibName:#"CatViewController" bundle:nil];
cvc.modalPresentationStyle = UIModalPresentationFormSheet;
cvc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
cvc.mainViewController = self;
[self presentModalViewController:cvc animated:YES];
[dvc release];
}
}
#end
#implementation DogViewController
- (void)showCatViewController {
[mainViewController showCatViewController]
}
#end
#implementation CatViewController
- (void)showDogViewController {
[mainViewController showDogViewController]
}
#end

problem with showing modalviewcontroller in landscape mode in iphone?

my application consist of a landscape view where i want to put a modalview but the problem is with modalview. it doesn't get load on presenting it.. code is:
--------------------code here----------------------
UIViewController *modalViewController = [[UIViewController alloc] init];
modalViewController.view = modelView1;
[self presentModalViewController:modalViewController animated:NO];
[self performSelector:#selector(hideSplash) withObject:nil afterDelay:5.0];
plz kindly help me with this....
The problem with ur code is that u are initializing it with alloc-init, without any nib name. Now when call:
[self presentModalViewController:modalViewController animated:NO];
The view will load itself by calling its loadview method, and u have definitely nothing in that. So if u do want to initialize in the same manner, just try to move the line of code:
modalViewController.view = modelView1;
after:
[self presentModalViewController:modalViewController animated:NO];
like:
[self presentModalViewController:modalViewController animated:NO];
modalViewController.view = modelView1;
I think this would work then.
Hope this helps.
thanks,
madhup

How to do a login screen?

I have this working but I don't think it is working correctly so I just wanted to get your feedback. I am trying to display a screen that has two buttons - one that takes you to a login screen and the the allows you to register.
II am testing in the appDelegate if they are logged in and if they aren't I am showing the signLogIN view.
signLogIN = [[LoginOrSignUPViewController alloc] init];
signLogIN.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
signLogIN.tabBarController = mainAPPTabBarController;
signLogIN.mainWindow = window;
[window addSubview:[signLogIN view]];
//[signLogIN release];
(I release in the appDelegate dealloc - if I release here it blows up when they select to either login or register).
I did try doing:-
[mainAPPTabBarController presentModalViewController:signLogIN animated:NO];
But it made no difference.
Curiously I can see that the dealloc in LoginOrSignUPViewController is called straight away - why is that? I can't tell where it is being called from.
From LoginOrSignUPViewController I am then displaying the login screen by doing:-
[self retainCount] = 1
LoginViewController *logINVC = [[LoginViewController alloc] initWithNibName:#"LoginViewController" bundle:nil];
logINVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
logINVC.delegate = self;
logINVC.tabBarController = self.tabBarController;
[self presentModalViewController:logINVC animated:YES];
[logINVC release];
now [self retainCount] = 3 = why did it go to three????
As you can see there is a delegate that calls back to the signLogIn view to close the view as follows:-
[self retainCount] = 3
[mainWindow bringSubviewToFront:tabBarController.view];
tabBarController.selectedIndex = 0;
[self.view removeFromSuperview];
[self dismissModalViewControllerAnimated:NO];
[self release];
[self retainCount] = 3 -- still 3 it never goes away
So here is my main problem LoginOrSignUPViewController never goes away it just sits behind my main view. The only line that makes any difference is the [mainWindow bringSubViewToFront. Does anyone have any ideas as to how to make the LoginOrSignUPViewController disappear?
Thanks very much
Cheryl
Have you tried this in your view controller's viewDidLoad:
LoginOrSignUPViewController *signLogIN = [[LoginOrSignUPViewController alloc] init];
[self presentModalViewController:signLogIN animated:NO];
[signLogIn release];