AQGridView - Orientation change in ExpanderDemo - iphone

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!

Related

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

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]];
}];

Objective C Segues, dissolve programmatically

I have two classes, machineClass and buttonsClass... From buttons class, I want a button to programmatically push into the machineClass.
Ive gotten that to work with:
machineClass *mc = [self.storyboard instantiateViewControllerWithIdentifier:#"machineClass"];
mc.passedString = purchase;
[self presentViewController:mc animated:YES completion:nil];
However, this uses the default segue animation (where the view comes up vertically), and I think my app would look so much nicer if I used the cross dissolve transition instead.
Can anyone help? The best solution I've come up with is to change it to:
[self presentViewController:mc animated:NO completion:nil];
But I don't like this as much...
Thanks!
You can set the target view controller's modal transition style in the storyboard. Or in code:
machineClass *mc = [self.storyboard instantiateViewControllerWithIdentifier:#"machineClass"];
mc.passedString = purchase;
mc.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentViewController:mc animated:YES completion:nil];

When to call selectRow: on a UIPickerView that has just loaded?

I am trying to learn iPhone/iOS programming. I have an UIPickerView that should dispay its selected row as soon as it becomes visible (it is contained on a flippSideView).
Unfortunately, the flipSideViewController's awakeFromNib is not called. It is somewhat too late to do it in viewDidLoad.
So, how can I make the pickerView display the selected row as soon it becomes visible?
Update:
Here is how I show the flipside view
- (IBAction)showInfo:(id)sender {
FlipsideViewController *controller = [[FlipsideViewController alloc] initWithNibName:#"FlipsideView" bundle:nil];
controller.delegate = self;
controller.uData = userData;
controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:controller animated:YES];
controller.pickerView.delegate = userData;
controller.pickerView.dataSource = userData;
[controller release];
}// showInfo
In the flipside controller there is a method mySelect (to help me trace trace the calls)
-(void) mySelect:(NSString*) strMethod{
int row = [uData getCurrentUserRow];
[pickerView selectRow:row inComponent:0 animated:NO];
NSLog(#"selectRow %d called from %# (pickerView=%d uData=%d)", row, strMethod, (int)pickerView, (int)uData); }
and when the program runs it generates the log
selectRow 3 called from viewDidLoad (pickerView=87412720 uData=89267696)
selectRow 3 called from viewWillAppear (pickerView=87412720 uData=89267696)
selectRow 3 called from viewDidAppear (pickerView=87412720 uData=89267696)
It seems you're having the problem i had a couple days ago, i really don't think it's a bug I think the problem is when everything is called (could be wrong). Correct me if I'm wrong but you want your PickerView to display a certain value when it's first shown onscreen correct? Are you creating the PickerView in code or from a nib?
In my app, the below code snippet is right at the bottom of my viewDidLoad method
[pickerView selectRow: 100 inComponent:0 animated:YES];
This works as intended. Please post a snippet of your code so we can better understand your problem.
PS: When developing for iOS i would stay away from awakeFromNib and just use ViewDidLoad:
There apparently is a bug in some versions of iOS that means your view is not loaded until you call [super viewWillAppear:animated] or force it to load by calling [self view].

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

MFMailComposeViewController displaying only bar

MFMailComposeViewController displaying only bar at the top of the screen with the cancel and send buttons. Code for landscape:
MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
controller.mailComposeDelegate = self;
[controller setSubject:#"In app email..."];
[controller setMessageBody:#"...Hi, all...." isHTML:NO];
//[self presentModalViewController:controller animated:YES];
controller.view.frame = CGRectMake(0,0,480,320);
[self.view addSubview:controller.view];
[controller release];
What is problem?
i've ever seen this problem before, as far as i know, you shouldn't replace the presentModalViewController method with addsubview.
I was getting this behavior, as well as the modal view coming in from the side and the modal view was stopping a quarter of the way through presenting.
In my app I had many view controllers stacked with addSubview:. I don't know why but it worked to present the modal view from the bottom view controller. I did something like this:
[((FirstViewController*)[UIApplication sharedApplication].delegate).firstViewControllerInstance sendEmailwithInfo];
Hope that helps! And maybe someone can give some insite as to why it was happening.