UISegmentControl - Unable to drag event to a function - ios

I am going through a iOS Programming tutorial using Xcode 8.1. Everything is going well until I needed to add a valueChanged event to the uisegmentcontrol element. When I drag it to bind to the function it does not work. Here is the gif I made that could explain better. Any help is greatly appreciated. thanks
Edit: Here is another gif of the actual tutorial that shows how the event is bound to the function. The full video can be found here actual tutorial. Thank you

I think you not set the class name of the scene.
E.g.
Name of Class for the Scene: ViewController.m
set StoryboardID if you need.

Thank you all. I just figure out that Xcode now add the parameter Any to all the functions generated. So to be able to bind the event to the function, I needed to change the parameter to AnyObject. I hope it helps someone else in the same situation. :)

Related

Adding array of UIImage in a UIViewController with some alignment

I just started my first project in iOS, recently I have encountered a problem in the UI when i receive it from the designer.
The expected output is shown as below and i can do most of it without any problem.
Now the problem came when I am about to implement this :
As the number of colour varies depending on item, I cannot add it like what I did for the share and love button I have no idea how can i implement something like this, I have look through the Object Library in the storyboard and cannot find any that can produce the output as expected .Any helps and guides are much apprecited!

Swift performSegueWithIdentifier delay

I have the following situation: I do a check when user touches screen, to check if it matches some bounds if menuButton.frame.contains(coordinates) {
Then, I try to push a segue like this performSegueWithIdentifier(menuButton.whichButton(menuButton.tag), sender: self) My problem is that the first time the segue performs, it has a huge delay (about 3-4 sec). Afterwards, everything runs as it should. I did check for main thread and I am in the main thread. Can you please help me?
I found the answer, as strange as it may appear, it was related with the fonts. I added some fonts, selected them in interface builder, but of course I didn't check the target membership. So the system was looking for them, I think, before reverting to default font, thus creating the lag. I hope it helps someone at some point.
Have you tried to run on a device or only in the simulator? Just to make sure...
You can try this too:
dispatch_async(dispatch_get_main_queue(),{
self.performSegueWithIdentifier(mysegueIdentifier, self)
})

iOS error message tooltip

I need to show error message as a tooltip in iOS 8 but i don't know how to do it. What I want is something similar to the one shown in below image (I'm referring to the tooltip with messages Select and Select All):
There is a great collection of libraries which already target your problem.
For example have a look at: AMPopTip.
Then you could show the popover like:
self.popTip = [AMPopTip popTip];
[self.popTip showText:errorMessage direction:AMPopTipDirectionUp maxWidth:200 inView:self.view fromFrame:textField.frame];
and hide it:
[self.popTip hide];
Have a look at the github repo there are more examples for customizing this control.
You can find more which might suit your needs better here: cocoacontrols.com
I had a similar problem and wrote my own custom tooltip.
You can init with your custom view (i assume you write some delegations to detect actions within.) and present from anywhere.
Maybe not the best replacement of UIPopoverController but still works great. And a lifesaver for iPhone. Also highly customisable.
https://github.com/akeara/AKETooltip
Hope this helps.

IOS: multiple language xcode 5 for launch image

I have a problem, what's the way to organize localized launch images in xcode 5, is there a way to do it?
thanks
SOLVED!!!!
Set in plist file "Launch image" in "Default"
and have two file for launch image in the project as
Default-Landscape#2x~ipad and Default-Landscape#~ipad
that you can localize as another file...
Yes, you have a way to do that. Looks like you can get an idea to your answer here in this post of StackOverflow Question.
Please do check the answer posted here. That is more close to your question.
Actually, you can create a temp ViewController and you can put a UIImageView on your View. After launch your program you can direct to this temp ViewController and set the image according to your language. than you can call your main ViewController.
And i used this class for change the language in my program.
https://github.com/tonisalae/TSLanguageManager
I hope, it can be help for you.

Autolayout view doesn't react to rotation of the phone

Perhaps I'm missing something obvious but for some reason my Autolayout view doesn't react to rotation of the phone. It works in different sample project I created but I don't seem to be able how and where it's enabled.
Could you please suggest what it can be ? I posted problematic XIB here: http://pastebin.com/Sb6ch6Ln
Ah, it's set in app's plist in parameter UISupportedInterfaceOrientations. Sorry for false alarm guys!

Resources