storyboard segue cross dissolve? - iphone

I want to use the following transition cross dissolve, but I do not want it to appear flicker when Transition
I apologize I have weak English language

You need to add a subclass to your project:
Add a new .h and .m file as a subclass of UIStoryboardSegue
Add this code to your .m file:
- (void)perform {
[self.sourceViewController presentModalViewController:self.destinationViewController
animated:NO];
}
Now go to your .storyboard and add the name of your .m file to the
class field of your prefered segue.

I can't find the storyboard's segue's class field in XCode 4.4.1. Is it possible that the field was in previous versions but not in the current?
EDIT: I found the way. You must select 'custom' when creating the segue and it works.
Thanks.
BTW: The tutorial is not available.

Related

IB - Can't assign class for a View Controller

I'm quite new to IOS developpement, and I'm facing a problem here that I haven't encountered before. Here's what I have :
I created a project, added some ViewControllers attached to their own classes. But now, I just added a new ViewController in the storyboard. Then I created a new Objective-C class (with is a subclass of UIViewController). The problem is that in IB, I can't link the ViewController to the newly created class, as I simply don't have the class in the list provided by IB (see the image below). My new class is called MapShownViewController, but as you can see on the image, it's not available.
It worked well for all my other classes but not for this one.
Here's the MapShownViewController.h :
#import <UIKit/UIKit.h>
#interface MapShownViewController : UIViewController
#end
And the MapShownViewController.m :
#import "MapShownViewController.h"
#interface MapShownViewController ()
#end
#implementation MapShownViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
}
- (void)viewDidUnload
{
[super viewDidUnload];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
#end
Can someone explain me what I made wrong please ?
I had this exact problem and it drove me mad. I first noticed it after upgrading XCode to 4.4 from 4.1. I had an existing project that I had been working on in the older version of XCode, and I continued to work on it in 4.4. I did exactly what you did and created a new View in the story board and then created the sub-class files, but the class just was not avaiable in the Custom Class dropdown in IB. After much Googling and frustration I resorted to Quit Xcode (complete quit, not just close) and then re-start it. Then as if by magic it all started working and the new class was immediatley available in the IB custom class dropdown.
Ran into the same issue and restarting XCode was no help. You can always right click the storyboard and select Open As > Source Code. Find your view controller element in the XML file and add a customClass attribute:
<viewController title="Login" id="TJH-Bg-q4u" customClass="XYZLoginViewController" sceneMemberID="viewController">
...
</viewController>
Manual override FTW :).
Check your project settings. xcode->targets->build phases->compile sources
your viewcontroller's implemantation file must be added to this list.
For this to work you have to make sure of the following:
1) The element added to the storyboard is an UIViewController
2) The class you defined has the UIViewController as its superclass
#interface MapShownViewController : UIViewController
3) The Class is being correctly built in the project.
I've been running into this issue and tried all other solutions posted here.
The thing that worked for me was to set the correct super class after creating a custom class. Then you should be able to find and select it from the class dropdown.
e.g.
class LabsViewController: UITableViewController {
Check if you did choose the correct super class in your new class. Sometimes you create a view controller inherited by a UITableVIewController. This one can't be applied to a ViewController pattern in the Storyboard.
I had to set my custom class which inherit from UIViewController and act as table view controller to UITableViewController. I made simple trick and just changed my custom class inheritance to ": UITableViewController" and then i can set this class freely to controller. Of course after it was set i changed inheritance back.
I had the same issue with Xcode 7.1.1 on a Mac OSX app. I tried all the suggestions from the other answers – no success.
Finally I deleted my view controller files and created brand new ones.
Then it suddenly worked...
Just adding another possible solution that helped solve my problem since the others didn't.
I noticed that searching for my custom View Controller file using Command+Shift+O it was being found, but I couldn't see in which folder the file was, so I noticed that for some reason my custom class was missing from the project but still being found in the search.
All I had to do was to move the files to the project again and Voila!
Hope this can help someone in the future.

Xcode 4.4 Connecting a .h and .m to a View Controller

I'm using Xcode 4.4 and I'm trying to connect the .h and .m files to the view controller in my storyboard but the options I have for adding files are:
Objective-C class
Objective-C category
Objective-C class extension
Objective-C protocol
Objective-C test case class
Every tutorial and answer I have found is for the 4.2 version which goes the option of Objective-C subclass which I don't have. I was wondering if anyone knew how to do it in 4.4.
Thanks
I had the same problem and just found the answer.
First, make sure to read Xcode help about storyboard (in help menu, type story...)
Second, Make sure XCode show you his full interface (in the tool bar, select all three view icons, or at least the bottom right and bottom left icon.
There is a video in the help which explain how to do so.
why you have to connect .m and .h to the view controller ?
try the easy way: file - new file - objective c class and in the second windows check "with XIB interface".
with this, you'll get .m .h and .xib !

how to update label/textfield of storyboard uiviewcontroller from controller.m?

I am new to iphone development, and i'm currently using xcode 4.2.
I drew a UIViewController into the storyboard. I put some labels into the UIViewController. It is associated to a controller.m file.
How do I, from the viewdidload function of the controller.m file, update the text in the label?
I don't know how to get the variable name or handle name of the elements in the uiviewcontroller on the storyboard.
If you are creating things through storyboard, the easiest way is to create an IBOutlet property for each UI element. This creates an instance property for the UIElement which you can then reference in your code - to set state, get values, etc.
You can do this through Control-click-drag on the UIElement to your UIViewController.h file (split view: RETURN-Command-Option: to display counterparts). XCode will pop up a dialog enabling you to name it (the same gesture will also enable you to create IBActions - the function that is called when the UIElement gets interacted with). You can also Control-click-drag on the left sidebar listing of the UIElements in your ViewController if that is easier.
There are YouTube videos that show it better than my weak explanation. I was skeptical # storyboard/IB at first because I don't like UI magic and prefer to do things through code, or at least see the code that results from the magic, but it really does work pretty well and saves some of the tedium of UI coding.
One gotcha to be aware of: if you make an IBOutlet and then delete the UIElement, you will have code errors because of the errant reference. Those are easy to find and fix. The UIViewController object will also contain those references and will result in unpleasant crashes - so Control-click on the UIViewController object (or use the Inspector panel) and any element that has an orange triangle == broken.

File's Owner didn't received Action

the ping1 and how1 below method didn't called from UIButton
so i was double checking it in xib what i am wrong.
but i can't found the problem.
to solve this only i can do is looking the xib and code
is there any know-how available to solve it?
something like insert some code when UIButton send event
anyone advice me it will be thankful
bonhyoung.
#interface ViewController : UIViewController
-(IBAction)ping1:(id)sender;
-(IBAction)how1:(id)sender;
#end
#implementation ViewController
-(IBAction)ping1:(id)sender
{
// i put the break point in here
}
-(IBAction)how1:(id)sender
{
// i put the break point in here
}
// some other code...
#end
You should connect some IBOutlets and check in viewDidLoad that your connections are right (ie that your IBOutlets are not nil once the view is loaded).
First make sure that the file owner's class is set to ViewController. This is in the IB pane, click on the File's Owner and select the 3rd tab on the right panel. It should say ViewController and not UIViewController.
Second make sure your actions are setup. Right click on the button, and make sure the Touch Up Inside is wired to the correct method.

What am i missing when creating applications from window-only template?

I'm fairly new to iOS development, but catching on pretty quickly.
I'm attempting to figure out how to create universal apps from the window-only template in xcode. I THOUGHT that i could add a main view to the main_window.xib by following these steps:
Make a new window-based app template.
Go to file > new file > uiviewcontroller subclass with XIB file.
Open the main_window.xib and add a new view controller, with my new uiviewcontroller subclass as the selected NIB name in the inspector.
Control-Drag from the window object to the new view controller, and add it as the rootViewController.
I thought that from here i had something that was essentially the same as the view-based template, but when i add in a segmented view controller, add the IBOutlet/IBAction in code, and then hook up the outlets and received actions in Interface Builder, the app crashes as it launches every time.
I'm positive that i'm missing a vital step in hooking up this process and would be greatful if anyone could offer the solution, as well as some general advice when setting up these sorts of things?
Thanks.
EDIT: Solved it by doing the following:
Create new window based template.
Create UIViewController Subclass, name it whatever you want.
In AppDelegate.h, add #class YourViewControllerName before #interface
Inside the #interface for appDelegate, add YourViewControllerName *mainViewController;
Then outside the #interface add #property (nonatomic, retain) IBOutlet YourViewControllerName *mainViewController;
In AppDelegate.m add in #import YourViewControllerName.h at the top.
Add #synthesize YourViewControllerName.
In ApplicationDidFinishLaunching add: [self.window addSubView:mainViewController.view]
Open MainWindow.xib in interface builder, drag in a new view controller from the library, and use the property inspector to change it's class to be YourViewControllerName, and select the corresponding NIB file from the drop-down menu.
Control drag from the app delegate, which is the yellow box in IB, to your new;y created view controller, and hook up the mainViewController outlet you created.
VOILA! done. Solved all my problems.
Many many thanks for the help guys.
Make an IBOutlet for your custom view controller, called viewController of type MyViewController (or whatever you want your class to be named) in your app delegate, and make MyViewController subclass UIViewController. Next, in the MainWindow.xib file, add a new view controller from the library, being sure to set the class of this view controller to MyViewController (or whatever your class name is). Next, hook up the viewContoller outlet to the view controller in the MainWindow.xib file, and in your applicationDidFinishLaunching method, add this:
[window addSubview:viewContoller.view];
That should do it!
this s my documentation ,this may helps you.....
create Window Based Application (name as your wise)
2.create UIviewcontroller class(.h & .m) with nib file
3.open appdelegate.h and import " view controller .h"(which created in step2)
ADD #class [view controller class name] before (#interface appDelegate )
ADD within #interface appDelegate
view controller class name *alias Name;
#property (nontoxic,retain)IBOutlet view controller class name *alias Name;
4.open appdelegate.m
1.#synthesize aliasname;
2.
-(void)applicationDidfinishLaunching:(UIApplication *)application
{
[window addsubView: aliasname.view];
[window makekeyAndVisible];
}
5.open mainwindow.xib
1.add UIviewcontroller from library
2.open property for UIviewcontroller ,add nib file name and class name
3.link window object with Uiviewcontroller using property