I have a problem. I created a Android.Support.V4.App.DialogFragment. Now I use this code to show the DialogFragment:
var TransDialogFragment = SupportFragmentManager.BeginTransaction();
Shape_Formation_Tutorial ShapeFormationTutorial = new Shape_Formation_Tutorial();
ShapeFormationTutorial.Show(TransDialogFragment, "ShapeFormationTutorial");
The problem is that I have added an animation to this dialog, but the animation isn't smooth at all, because when I try to show the Dialog, first it needs to be created. This takes too long, so I need to preload it somehow.
Can someone help me with that?
Related
At current moment, i'm using ContainerView approach, where is going switch between ViewControllers like that:
FromViewController.WillMoveToParentViewController(null);
ToViewController.View.Frame = SourceViewController.View.Bounds;
SourceViewController.AddChildViewController(ToViewController);
SourceViewController.Tansition(FromViewController,ToViewController,
0.5,UIViewAnimationOptions.TransitionCrossDissolve,() => {} ,(bool IsFinished) =>
{
FromViewController.RemoveFromParentViewController();
ToViewController.DidMoveToParentViewController(SourceViewController);
});
All work's fine, except one thing : anytime when i'm switching between them(ViewControllers),they recreates from zero.
And now i want to do the same stuff, but without re-creation of each VC that is switched at current moment.
Questions :
I don't want to recreate VC each time, when switch is doing job. Somehow to make an overlay of VC on another one and vice versa or maybe it should be hided!? Is this a good approach to achieve my goal?
What about memory usage of this approach? For e.g. : if i will have several VC's (like 4-5 quantity). Is this fine to make it or anyway i need to destroy them and recreate from zero?
Any advice? Thanks!
Assign the 2 view controllers to variables of the class. You can lazy load them so they won't get created every time you access them.
It's totally fine, in fact this is how the UITabBarViewController behaves.
I want to use a view controller from a storyboard twice (DRY!). However, in one case I'd like it to be full screen, and in other I'd like it to be roughly 3/4 of the screen (within another VC). How can I reuse it like that?
There is a great library for that. I didn't create it but I have used it: https://github.com/m1entus/MZFormSheetController
here is a partial snippet
MZFormSheetSegue *formSheetSegue = (MZFormSheetSegue *)segue;
MZFormSheetController *formSheet = formSheetSegue.formSheetController;
formSheet.transitionStyle = MZFormSheetTransitionStyleBounce;
formSheet.shouldCenterVertically = YES;
formSheet.cornerRadius = 0;
formSheet.presentedFormSheetSize = CGSizeMake(290, 290);
So the idea is that, when you segue, if you want full size then segue normally. If you want smaller size, use as I show in the snippet above. Read the readme and the example.
Instead of going on and one, I am leaving it to you to ask more question if you need further help as you try out the git project.
I am creating a list and displaying it in a UITableView. While viewing I want to delete an item and then save the updated list, allowing me to refresh the old list with a refresh button. I use a button to save the current list, then a refresh button to reload the data into the view. The problem is the code within the save button always runs, even when I don't press the button. I can explain best like this:
btnSave.TouchUpInside += delegate { _ListCopy = new List<Tasks>();
};
btnReset.TouchUpInside += delegate {
tblTotal.ReloadData();
tblTotal.DataSource = new ListDataSource(_ListCopy,txtTotalCost);
};
tblTotal.DataSource = new ListDataSource (_ListOfTasks,txtTotalCost);
When I run this the table view shows the _ListOfTaskslist, when I press btnReset the _ListCopy is reloaded as the data source. The issue I am having is that the value for _ListCopy is assigned even when I don't press btnSave. In this case the view is cleared. If I comment out the line _listCopy = new List<Tasks>(); I receive a null reference exception in the table view Data Source here:
public override int RowsInSection (UITableView tableView, int section)
{ return _ListOfTasks.Count; } <-- exception
indicating to me that the value of _ListCopy is empty. I thought I could make _ListCopy = _ListOfTasks in place of new List. But, for some reason the code is running in the save button regardless, so I am never able to save the correct list value when I want it. Why is_ListCopy be assigned a value without telling it? I do not assign it a value anywhere else either. Can someone explain what is happening? Is there a different solution that I could use instead?
I discovered that I had my outlets setup wrong. For some reason I had two outlets wired to btnreset and no outlets for btnsave. So when I pressed reset, I was also firing off the code for btnsave. I solved the whole issue by correcting my outlets. As for making a copy of the original list: I was trying to simply make _ListCopy = _ListOfTasks for the save function. This only pointed to the memory location of _ListOfTasks, which included any changes. I corrected this by writing a foreach loop to copy one list to the other
foreach( var task in _ListOfTasks)
{
_ListCopy.Add(task);
}
Now I can press save and the first estimate is stored. I can do any deletions, and if the customer wants to revisit the initial estimate I can refresh the data.
I have a problem, I dont know why but my data-init function in a main view is being called when I navigate back to that page for the first time. I want to separate some initialization logic from show logic in the starting view.
View is defined as a first (and only) view inside the body element.
<div data-role="view" id="..." data-model="..." data-init="initFnc" data-show="show">
</div>
I create the app like this:
var app = new kendo.mobile.Application(document.body, { transition: "slide" });
So once again sequence of events, just to be clear:
app started, main view opened -> init and show functions called
navigate away to another view, navigate back -> init and show functions called
navigate away to another view, navigate back -> show function called
In step 2, I want to call only the "show" function.
Thanks!
This behaviour is not normal - the init event should be fired once. Most likely your navigation goes wrong and loads your homepage as a remote view. Or you instantiate the app multiple times.
That does not seems to be the case, what you shared looks completely valid. Take a look in this demo.
I am using AQGridView with Xib file. I have set the basic Project just as explained in the Video by Evadne Wu. And i am moving to next Grid using expandFromRect from ExpansionDemo and the Grid is loaded fine but whenever i click anywhere on the grid i get EXC_BAD_ACCESS and exception is generated without any Log about the reason.
Also that the didSelectItemAtIndex doesn't get called even though i have set the self.gridView.delegate = self;
self.gridView.dataSource = self;
Try this.
EDIT: This usually ensures that the delegate methods are getting called. :)
Finally it is resolved. One thing that i haven't read Known Bugs while setting up AQGridView i.e. do not pile multiple animations on top of one another that was the main reason i was facing the issue. So, while the grid was animating i blocked start of any other grid Animation and hence the issue was resolved