view controller is showing blank in storyboard - uiviewcontroller

I have copied a view controller from one project to another . but after that it is showing blank.
and I have also tried this ...
any suggestion?

I solved this by using this way
Storyboard -> Attribute inspector -> simulator size -> Fixed

That seems Xcode bug, Quit Xcode and run it again or switch between storyboard it will be normal.

Are you sure after copying viewcontroller your set initial view controller?
in above image at right middle you can see check box labeld as "Is initial view controller" check that box after selecting viewcontroller/navigationcontroller which your want to set first

Related

Is it possible to use Auto Layout on some View Controllers and Autoresize on others? (Swift 4)

I am trying to use Autoresize on some of my View Controllers Auto Layout on others. Everything looks fine on all device sizes when I use the "View As:" tool in Storyboards. There are no overlaps and everything fits nicely. However, I have Auto Layout Warnings:
Why am I getting these warnings if nothing is clipping or overlapping? And how do I get rid of them?
Well I think you don't need to do any special steps, just try adding auto-layout margins using (control + actions told) storyboard and xCode will automatically handles them separately.
Other controllers that you have made ready using Auto-resizing would not be effected by this.
And new controller you made ready with auto-layout would work fine as well.
Hope this would work out for you.
For reference adding 2 screenshots (both are from same xCode project) for you to be clear of that what I am trying to say...
if you don't want to use auto layout just disable it.
select ViewController in storybored,go to file inspecter -> locate the Interface Builder Document section.uncheck use Autolayout.

Is it possible to see all the variable and its value stored in browser momory?

I would like to know the way to see all the variables and its saved values in google chrome using 'developer tool'. Can anybody help me..
It's a little hard to navigate, but if you're using chrome:
F12 -> Elements -> (in the bottom right) Properites shows you all available nodes and their values.
I am guessing you mean variables from your JavaScript file?
If yes, you can use debugger.
Open Dev Tools F12
Select Tab "Sources"
Find a .js file you want to debug
Put a breakpoint after a variable declaration
Refresh and you will see values of declared variables in scope.
More about this:
https://developers.google.com/web/tools/chrome-devtools/debug/breakpoints/?hl=en
https://scotch.io/tutorials/debugging-javascript-with-chrome-devtools-breakpoints

How to prevent game controller button B from quitting app / navigating back to menu in tvOS

The game controller button B is, by default, quitting the app and navigating back to the tvOS home screen. At first I thought this was intuitive, but quickly realized that's what the Nimbus MENU button (dead middle of the controller) is for, and that I actually want to use button B in-game.
Setting a change handler for button B works, but the app still quits when the button is released.
GCControllerButtonValueChangedHandler buttonBHandler = ^(GCControllerButtonInput *button, float value, BOOL pressed) {
NSLog(#"B");
};
I had the same issue.
The solution was to have my main ViewController inherit from GCEventViewController instead of UIViewController.
By default, when using GCEventViewController, the MENU button will not return to the menu. In this case, if you want it to be able to return to the menu with the original behavior you can simply set controllerUserInteractionEnabled to YES.
see the documentation for this class here :
https://developer.apple.com/library/tvos/documentation/GameController/Reference/GCEventViewController_Ref/index.html
edit : apple dev forum helpep me fix this issue : https://forums.developer.apple.com/message/57926#57926
hope this helps,
I too had the issue, related to Unity, but I think this rather hacky solution can help.
Deriving from GCEventViewController one can override several methods, one of them is:
- (void)pressesBegan:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event
returning or handling presses without calling super removes all calls to the internals.

Content Dialog template in Visual Studio C#

I'm starting to learn Windows 8.1 phone development and I am trying to get the Content Dialog template to work inside a Pivot page. Work some reason, when I try to get the Add app bar button to navigate to the ContentDialog.xaml page, it is not displaying, but I see the navigate go to the ContentDialog constructor where the this.InitializeComponent() occurs.
I am finding very little online in way of examples on this template, so I am at a loss as to what I am missing. I understand that the ContentDialog page that was created from the template is inheriting from ContentDialog and not Page, but I'm not sure if this is still supposed to be directly accessed or if this XAML is supposed to be inside another "Page" XAML file.
Can someone please help.
The code looks like this in the Pivot page when the click event is selected:
Frame.Navigate(typeof(ContentDialog1));
I really haven't even touched the ContentDialog template from it's default yet, so it is set up like a set password page.
Thanks in advance
UPDATE
I found the answer to my question above. apparently, because it is a Content control, it needs to be called like a normal dialog would need to be called in it's code behind. I think my missconseption was that I thought it being "a template", that when I called it with the navigation calls that it would already have everything needed to get fired. You can also add the Content control to an existing page if you would like.
In either scenario, you need to add a method similar to this in your XAML.CS file.
private async void OpenDialog()
{
await this.contentStuff.ShowAsync();
}
You then need to call this method in the constructor. Then, when called, your dialog will appear.
Hope this helps others just starting out.

"Does not make sense to draw an image" - Warning after upgrade to MountainLion

After I upgraded my programming machine to MountainLion and XCode to the new version I get this warning printed into the console everytime I run my application:
It does not make sense to draw an image when [NSGraphicsContext
currentContext] is nil. This is a programming error. Break on void
_NSWarnForDrawingImageWithNoCurrentContext() to debug. This will be logged only once. This may break in the future.
I'm not using an Image anywhere in my Application and I searched the whole project for an image but couldn't find one. Does anybody know what could cause this?
I'm using 2 nib files btw: One Popover and the Mainwindow. Neither of them contains an image.
Edit:
I found the line when this appears:
[self.popover showRelativeToRect:[appDelegate.menulet frame]
ofView:appDelegate.menulet
preferredEdge:NSMinYEdge];
But none of those object is nil. Any suggestions?
Edit 2:
The Menulet is a NSView subclass btw. So I'm passing a view.
I tried setting the breakpoint but it is called when the nib loads. So it is very non-specific. I created a copy of the nib and then deleted objects from it one by one until the warning went away. In my case, it was an NSOutlineView. But as as soon as I added a new NSOutlineView, the error came back.
I was finally able to remove the warning by rebuilding the entire NIB by hand. Painstaking but it got rid of the warning.
If you have a NSImageView that's initialized in the nib but with no image set (and you draw the image yourself in code) just set it and the warning will be gone.
In my case, it's because the image size is {0,0}, which "doesn't make sense".
Actually, the image is for a NSButton, I change the button's image programmatically. In one case, the button should be empty, so I just set an empty image with [NSImage new].
But the error occurs, then no matter how I change the button's image, the button is always empty.
After setting a size to the empty image, the problem is solved, and I can change the button's image successfully.
In my case the warning resulted in rewriting my menuIcon with a rectangle (Working on a menuBar application). Haven't solved the problem yet, but I know where it came from in my case. If you have a menubar application, check the code which generates your icon.