Xamarin iOS Storyboard having rendering error NullReferenceException - xamarin

When opening storyboard recently, the ViewController in the Storyboard will have problem rendering. It is showing NullReferenceException.
What can be the problem?

Found out that we need to disable the rendering of screen in UI Designer (Recent version of Xamarin will add the screen into Custom Components too).
To turn off the rendering, we need to set the DesignTimeVisible flag to false.
[System.ComponentModel.DesignTimeVisible(false)]
public partial class ViewController : UIViewController
I have also written more details in my blog HERE.

Related

Xcode UICollectionViewCell xib not displaying any views added to it

I'm trying to create a custom UICollectionViewCell backed by a *.xib file.
However, when I try to add subviews to the cell, interface builder (as well as an actual instance of the cell inside the app) doesn't show them at all.
It doesn't matter whether I add in an UIView as a contentView or not, all subviews seem to be invisible.
This happens in Xcode 7.2 inside a tvOS project. Does anyone experience the same issue or can see what I'm missing?

How to incorporate a UISearchController into new (iOS8) UISplitviewController

I try to build a simple app based on the UISplitViewController template from Xcode 6 for universal apps (with Storyboard and CoreData/NSFetchedResultsController). This app should also provide a search bar for the MasterViewController. Unfortunately, Xcode 6 provides no InterfaceBuilder element for the UISearchBar/UISearchController combo (only the depreciated UISearchBar/UISearchDisplayController).
In the iOS Developer library, Apple provides the "Table Search with UISearchController" example, but this is not based on the UISplitViewController and supports only iPhone.
My problem is, that I'm not able to show the detail view on the correct ViewController under all circumstances. I tried to transfer the approach from the Apple example project to the UISplitViewController template. In this, one is encouraged to show the search results in a separate UITableViewController subclass (ResultsTableViewController) and use this as the searchResultsController of the UISearchController. I was not able to create a scene in InterfaceBuilder for this setup so I had to add these manually in code.
The problems begin when I click on a table cell of the ResultsTableViewController. This vc is not part of the scene in InterfaceBuilde and I don't know how to add it to the SplitViewController setting correctly. The biggest problem is the weird behavoir of the iPhone 6 Plus and the UISplitViewController. In portrait mode it behaves like an iPhone and doesn't seem to have a SplitViewController and only uses a NavigationController to which I push my DetailViewController. In landscape mode it behaves like an iPad with SplitViewController were I have to get the second ViewController of the SplitViewController childControllers and push the DetailViewController on this one.
Now it happens, when I start in portrait mode and switch to landscape mode that the DetailViewController is all gone, showing gray space where the DetailVC should be. It seems, when going to portrait mode, the DetailViewController gets kicked from the SplitViewController (or the SplitViewController gets kicked at all in favor for the iPhones NavigationController setup). When switching back to landscape the SplitViewController is initialized again but without proper initialization of the DetailViewController.
Is there any template or suggestion on how to correctly implement search capabilities on a universal UISplitViewController?
Cheers
Björn

iOS 7 force landscape on a UIViewController with UINavigationController

In my app I want one view controller to be shown in landscape because it is a signature pad. The rest of the views are portrait. I can force the view to be landscape without a problem as long as it is not embedded in a Navigation Controller. The problem is that I want the Navigation bar to show also. Does anyone know a workaround for this?
You can either present your view controller instead of push using UINavigationController (See kjam's solution in the following link) or you may try this solution of arpan_techisavy.

Xcode 4.5 "Apply retina 4 Form factor" toggle button not working properly

I'm trying to update an IOS app for IOS6 and iPhone 5, but I have a problem resizing some views from the main Storyboard.
When I click on the new "Apply Retina 4 Form Factor" button, some of the views included in the StoryBoard don´t resize. I´ve checked all the settings for every Scene and seem to be configured in the same way. Any idea? Thanks in advance.
You might have found your solution but I just had a similar problem. For future notice, I found the fix was in the show size inspector and instead of using layout rectangle, I used frame rectangle.
I was having the same problem, this answer worked for me and finally removed the letterbox:
https://stackoverflow.com/a/12927282/539149
So add a 640x1136 launch image called Default-568h#2x.png and set the "Retina (4-inch)" target setting to it. More info for the other sizes here:
http://www.idev101.com/code/User_Interface/launchImages.html
Just in case it helps others, I had tried these links and none of them got rid of the letterbox, but they did at least enable the resize masks:
Resize of UIViewController in storyboard
Xcode 4.5: can't set root view autoresizingMask in Interface Builder
how do you resize (visually, not programmatically) the detail view of a UISplitViewController in a storyboard?
iphone 5 and storyboard setting autoresizing masks

UITableView no longer scrolling using xCode 4.5, deploying on 5.x or 6.0

Deployed project using UITableView for display of images.
Upgraded to xCode 4.5, suddenly my UITableView no longer scrolls.
This occurs both on the device and on the simulator with iOS 5.0 -> 6.0
Additionally, I have found that I can no longer set the number of minimum touches for the PanGestureRecognizer programmatically.
Other StackOverflow ticket
In fact, a Zombie analysis reveals that the recognizer has been released. This could definitely explain the above behavior. My attempt to set the recognizer is as follows and crashes.
UIPanGestureRecognizer* pgr = [imageTableView panGestureRecognizer];
[pgr setMinimumNumberOfTouches:2];
[pgr setMaximumNumberOfTouches:2];
Is anyone else seeing this issue?
I had a similar problem when moving to iOS6/XCode 4.5. It seems that the UIPanGestureRecognizer now steals touches from underlying UIScrollViews or UITableViews.
I found a work around for this in the post below. It's not the top rated answer, so I'll re-paste the content below as well:
iphone - UIGestureRecognizer prevents UITableView from scrolling in Xcode 4.5
I had the same issue: I used to drag my TabGestureRecognizer directly onto the storyboard instead of creating them through code. With iOS6 this now seems to break scrolling.
I prefer adding views, gestures, etc directly onto the storyboard instead of through code.
You can still do this but with two changes:
1) Referencing Outlet Collections
Right-click the GestureRecognizer which is visible to you within the scene's dock.
Clear the section Referencing Outlet Collections
2) Attach the GestureRecognizer to the related view through code
Create an outlet for your GestureRecognizer
Add the following line within the viewDidLoad method:
[self.tableView addGestureRecognizer:_tabGesture];

Resources