swift,select,uisegmentedcontrol
From the Apple Documentation Content for each segment is set individually. Using the Segment field, you can select a particular segment to modify its content. So you can not choose multiple segments into Segmented Control. For more information read that document....
ios,objective-c,uisegmentedcontrol
You have a double equals in your assignment to self.itemCondition. That's a comparison operator. You need to use just '=' to assign a value. Also, if itemCondition is an NSString, then you need to change the syntax for each assignment so it looks like this: self.itemCondition = @"new"; Note the...
ios,objective-c,uisegmentedcontrol
You have to enable the segmented control first. Then you can enable or disable individual segments. Perhaps you should keep the segmented controls enabled all the time, and only update the individual segments, depending on the color. Something like [secondRow setEnabled:(colorIndex == 2) forSegmentAtIndex:0]; [secondRow setEnabled:(colorIndex == 1) forSegmentAtIndex:1]; [secondRow...
ios,if-statement,uisegmentedcontrol
If you read the docs for UISegmentedControl you will find the answer: if (segmentTitle.selectedSegmentIndex == UISegmentedControlNoSegment) { segmentTitle.selectedSegmentIndex = 0; } ...
ios,uisegmentedcontrol,size-classes
You can use size classes in Interface Builder to substitute a different segmented control with a larger font size when you're running on iPad as opposed to iPhone. But you cannot use size class in Interface Builder just to set a different font size on the same segmented control.
swift,uicollectionview,uisegmentedcontrol
The correct control event would be .ValueChanged: headerView.controlSegment.addTarget(self, action: Selector("segmentAction:"), forControlEvents: .ValueChanged) ...
ios,objective-c,cocoa-touch,uiview,uisegmentedcontrol
It's not clear to me why you would get this error if you change the layouts during scrolling, but you might be able to fix it by disabling your segmented control in scrollViewWillBeginDragging:, and re-enabling it in scrollViewDidEndDecelerating:. Make sure you set your controller to be the collection views' delegate.
ios,uiimage,uikit,uisegmentedcontrol
I figured it out. Turns out the segmented controller's frame is of 44pts height, and the background images was 75ptsx75pts. Since i've set the image's top and bottom inset to 18pts, the OS was taking the image's top and bottom 18pts and resizing it, ignoring the rest. Here is the...
xcode,parse.com,uisegmentedcontrol
A UISegmentedControl has a property to get the selected segment, you can use this on save to determine which value the user selected. So whenever a user hits the save button in your app, get the value of that property (an int) like so for example mySegmentedControl.selectedSegmentIndex. To automatically get...
A UISegmentedControl "sticks" when it is selected by default. You're getting the behavior you describe because you set the momentary property to YES. The default is NO, so just delete that line.
ios,uipopovercontroller,uisegmentedcontrol
You would need to create a View with those "Options" you want manually. Or you could use third party library such as this Add a UILongPressGestureRecognizer to your UIView Get the position of the touch location and show the popover ...
if you have a standard UISegmentedControl you can use the following idea: [_segmentedControl.subviews enumerateObjectsUsingBlock:^(UIView * obj, NSUInteger idx, BOOL *stop) { [obj.subviews enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { if ([obj isKindOfClass:[UILabel class]]) { UILabel *_tempLabel = (UILabel *)obj; [_tempLabel setNumberOfLines:0]; } }]; }]; you may need to set the...
swift,uitableview,uisegmentedcontrol
The only way how I can imagine it is happening — tableView is nil in a orderTable call. I can not find anywhere in the code assignment of table to a tableView. How is it initialized? It also worth to mention that tableView in delegate and dataSource methods a local parameter...
objective-c,xcode,uilabel,uisegmentedcontrol
Connect your UISegment control for action event "valuechanged" and write following method for change label text as user changes his/her Selection. - (IBAction)segment_Changed:(id)sender{ UISegmentedControl * segment = (UISegmentedControl *)sender; if(segment.selectedSegmentIndex == 0){ weightLabel.text = @"Yards"; spaceLabel.text = @"Pounds"; }else if (segment.selectedSegmentIndex == 1){ weightLabel.text = @"Meters"; spaceLabel.text = @"Kilograms"; }}...
Since you are declaring your variable as "weak", it will get deallocated as soon as you assign it. But you should not do it anyway, because it is @IBOutlet -> you should connect it through interface builder. As for changing the title, instead of just creating new SC, use self.viewPicker.setTitle("",...
You need an outlet to the UISegmentedControl @IBOutlet weak var segmentedControl: UISegmentedControl! Then you can access the current selection using. segmentedControl.selectedSegmentIndex ...
ios,swift,uinavigationbar,uisegmentedcontrol
Yes, you are right: if you manually create the two VCs in your mapViewController, they will be different instances from those created by a segue. So if you want to stick with Red Artisan's solution, present the VCs using code rather than segues. You can still design the two VCs...
ios,uiimage,title,uisegmentedcontrol
The official documentation for -setImage:forSegmentAtIndex: says A segment can only have an image or a title; it can’t have both. There is no default image. So, no, there is no way to do what you want using the image and title properties. However, there are a few options to accomplish...
This was an ios7 change. Now UISegmentedControl uses the tint color of self to change tint of the image, so you have to render the image in its original mode. UIImage* iPhoneImage = [UIImage imageNamed:@"iphone1.png"]; if (//Device is iOS7 or higher) { iPhoneImage = [iPhoneImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; } NSArray *segments =...
You set your target to fire just when the value change, so if you select the same segment the value will not change and the popover will not display, try to change the event to TouchUpInside, so it will be fired every time you touch inside the segment segmetedControl.addTarget(self, action:...
You can just pass nil to rightMenuViewController and that should do it. You should pass nil to the side which you do not wish to have. MFSideMenuContainerViewController *container = [MFSideMenuContainerViewController containerWithCenterViewController:[self navigationController] leftMenuViewController:leftMenuViewController rightMenuViewController:nil]; ...
swift,uisegmentedcontrol,optional
As found from the comments. You were just logging the language before assigning it the correct value. In this case if you just swap the assignment of language and the print statement you should be good: @IBAction func setLanguage(sender: AnyObject) { if self.selectLanguage.selectedSegmentIndex == 0 { // Assignment language =...
ios,objective-c,uisegmentedcontrol
Half of 1/3 is not 1/4. It is 1/6. You will probably want to set three of the segments and leave the last one to be set automatically to fill the remainder. Don't run your code too early - if you do, the segmented control may not have achieved...
ios,objective-c,cocoa-touch,uisegmentedcontrol
Please try with below code for (UIView *v in [[[segment subviews] objectAtIndex:0] subviews]) { if ([v isKindOfClass:[UILabel class]]) { UILabel *label=(UILabel *) v ; lable.font=[UIFont systemFontOfSize:13.0f]; } } ...
ios,objective-c,uisegmentedcontrol
I have answered a similar (not the same, but similar result) question here: How To Switch Views With NSNotifications Basically you can switch views using NSNotifications. Your fist view will load and using NSNotifications you can send a notification to a custom class that listens and responds by changing the...
ios,objective-c,iphone,uiviewcontroller,uisegmentedcontrol
Ok, so I can't really understand some parts of how and why you want to do what you want to do. From what I understood, you want to hide the 'First' controller and show the 'Second' controller instead, but in doing so, you don't want to release the 'multiswitch' control....
ios,cocoa-touch,uiview,uikit,uisegmentedcontrol
The segmented control is not going to change the way it draws its corners, so it is continuing to draw its corners in its own way and you are then cutting them off. You are not in charge of how a segmented control draws its boundary shape. If you truly...
ios,objective-c,ios7,uisegmentedcontrol
I can only think that the problem is because of some unusual thing you're doing to the segmented control. When I set the background image of a segmented control and set the titles of the segments, I don't get any white rectangle - see the attached screen shot. I tried...
UI can use control appearance, best place to add it is in app delegate, didFinishLaunchingWithOptions method, use this if you want to set up the same attribute to every UISegmentedControls in your project just once: var attr = NSDictionary(object: UIFont(name: "HelveticaNeue-Bold", size: 16.0)!, forKey: NSFontAttributeName) UISegmentedControl.appearance().setTitleTextAttributes(attr, forState: .Normal) But if...
ios,objective-c,autolayout,uisegmentedcontrol
The problem is that your code is in the wrong place. Put it in viewDidLayoutSubviews and all will be well.
@MatthiasBauch's comment helped me track down the whole solution, as detailed below: NOTE: I'm using Autolayout, so anywhere I use the Storyboard you'll have to substitute it with the programmatic equivalent. 1) First, drag a "Segmented Control" out on the the storyboard. 2) Create an Outlet for the Control you...
ios,xcode4.2,uisegmentedcontrol,segmentedcontrol
Depending on how demanding the content four views is, I would suggest to make one main view for the segmented control and set up four container views in the main view. The three of them should be hidden and then you can toggle between the four views (show/hide). This is...
ios,objective-c,nsarray,uisegmentedcontrol,for-in-loop
There are only two possible reasons for what you see: None of the array's elements is a UILabel There are no elements in the array. This could be because [self.segment.subviews objectAtIndex:0] returns nil, which only means that the self.segment is nil. Try to explore the view hierarchy, before you assume...
ios,objective-c,autolayout,uisegmentedcontrol,uitoolbar
I created a toolbar with a segmented control inside, then made the segmented control 320 wide. I then set flexible layout guides on each side to force the segmented control into the center. This looks fine in portrait, but the segmented control will not stretch out for landscape. Portrait (includes...
I found out that one of the old interval methods was depreciate in iOS 8.0. I found I need to use: notification.repeatInterval = NSCalendarUnit.CalendarUnitWeekOfMonth ...
objective-c,uisegmentedcontrol,unrecognized-selector
The error is saying that something sent the message -matchModeSegmentedControl: to an instance of CardGameViewController. Note the colon on that message name. Your class has a property matchModeSegmentedControl whose getter is a method named after the property (-matchModeSegmentedControl). Note, no colon in that method name. Your class also has an...
ios,objective-c,iphone,uitableview,uisegmentedcontrol
Two things. First you should clear the data before you updated the cells cell.textLabel.text = nil cell.imageView.image = nil switch (self.segmentedControliPhone4.selectedSegmentIndex) { case 0: cell.textLabel.text = @"Acitivy Feed"; cell.imageView.image = [UIImage imageNamed:@"brand.png"]; break; case 1: cell.textLabel.text = @"Hot Box"; break; case 2: cell.textLabel.text = @"Collections"; break; } Second, in segmentedControlIndexChanged...
user-interface,swift,operators,uisegmentedcontrol
If you want to get the value of the selected UISegmentedControl, you can do something like that: var myInt:Int = reps.titleForSegmentAtIndex(reps.selectedSegmentIndex)!.toInt()! BUT I'd highly recommend you to use double, as your choice of type, because int isn't that great for calculations. So you would have to cast your string into...
ios,swift,uitableview,uisegmentedcontrol
You have default branch with not initialized cell variable that you returns. I would recommend the change like following: func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let result: UITableViewCell if (segmentedControl.selectedSegmentIndex == 0) { var cellOne = tableView.dequeueReusableCellWithIdentifier("CellOne", forIndexPath: indexPath) as! CellOne //Configure here result = cellOne }...
ios,uitextfield,uitextview,uisegmentedcontrol
Try this: - (void) checkTextFields { if ([self.nameTextField.text length] != 0 && [self.itemTextField.text length] != 0 && [self.occasionTextField.text length] != 0 && ([self.isReceivedSegment selectedSegmentIndex] == 0 || [self.isReceivedSegment selectedSegmentIndex] == 1)) { NSLog(@"This shouldn't be run if not every field is filled in"); self.saveButton.enabled = TRUE; } else { NSLog(@"Run");...
ios,objective-c,iphone,swift,uisegmentedcontrol
There is no right answer since we don't have the source code. However it could be one of those proposition : Using a UISegmentedControl and customize it's appearance ; Using two UIButton and change there appearance depending on which one is currently selected ; Creating your own component : IBDesignable...
ios,iphone,uitableview,swift,uisegmentedcontrol
If you use commitEditingstyle, then your cells will still display the Delete button when you swipe. Use editingStyleForRowAtIndexPath: instead. Put an if statement in to test which segment is selected, and return UITableViewCellEditingStyle.None (to disable swipe to delete) or .Delete (to enable swipe to delete) accordingly. If you want to...
objective-c,uitableview,uisegmentedcontrol,nssortdescriptor
NSArray *arrayToSort = [[ArtistDataStore sharedStore] artists]; NSString *key; if (segment.selectedSegmentIndex == 0) { key = @"name"; } else if (segment.selectedSegmentIndex == 1) { key = @"stock"; } else if (segment.selectedSegmentIndex == 2) { key = @"price"; } NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:key ascending:YES]; self.artists = [arrayToSort sortedArrayUsingDescriptors:@[sortDescriptor]]; [self.tableView reloadData];...
ios,xcode6,storyboard,uisegmentedcontrol
Setup your storyboard so it looks like this: An ensure to give each segue the appropriate identifier in the Attributes Inspector (Command+Option+4). Please bare in mind that using a segmented control for pushing on view controllers isn't a standard UI paradigm. It may be more appropriate to use regular UIButton...
ios,swift,uitableview,uisegmentedcontrol,delete-row
Return one UITableViewRowAction in case 0,return two UITableViewRowAction in case 1, Try this override func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [AnyObject]? { var moreRowAction = UITableViewRowAction() var deleteRowAction = UITableViewRowAction() switch (self.segmentControl.selectedSegmentIndex) { case 0: moreRowAction = UITableViewRowAction(style: UITableViewRowActionStyle.Default, title: "More", handler:{action, indexpath in println("MORE•ACTION"); }); return [moreRowAction]; case...
I accomplish this by using setTitleTextAttributes. The example below uses a dictionary to set attributes since you most likely want to set font type and size at the same time. Try this to set your selected segment text color to red: let segAttributes: NSDictionary = [ NSForegroundColorAttributeName: UIColor.redColor(), NSFontAttributeName: UIFont(name:...
ios,uitableview,uinavigationcontroller,uisegmentedcontrol
Why do you delay the goSegue method? hitting the item multiple times before afterDelay has elapsed will cause trouble. I would change: [self performSelector:@selector(goSegue) withObject:nil afterDelay:0.35]; to: [self goSegue]; ...
ios,iphone,swift,uisegmentedcontrol,uicontainerview
I found a solution to have all three views loaded into memory and be able to change which function I am calling using @Julian's response: Objective-c: How to invoke method in container view controller //Determine which view is showing and point to the correct child class func sendTransactionButton(sender: UIBarButtonItem) {...
ios,objective-c,localization,uisegmentedcontrol
Try This one You didn't need to set any min font size. It will change font size automatically to show title if needed. NSArray *itemArray = [NSArray arrayWithObjects: @"Title1 testing font size", @"Title2", @"Titl3",nil]; UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] initWithItems:itemArray]; segmentedControl.frame = YOUR_FRAME; [segmentedControl addTarget:self action:@selector(segmentControlClicked:) forControlEvents:UIControlEventValueChanged]; [self.view addSubview:segmentedControl]; for...
ios,cocoa-touch,ios8,uisegmentedcontrol
Try something like this ? for (UIView *subView in mySegmentedControl.subviews) { [subView setTintColor: [UIColor greenColor]]; } But it actually appears that it is a known issue in iOS 7, I don't know if it has been fixed in iOS 8. "You cannot customize the segmented control’s style on iOS 7....
ios,swift,switch-statement,uicollectionview,uisegmentedcontrol
In your viewDidLoad set selectedSegmentedIndex to 0 (or 1) because the default value is -1. tabs.selectedSegmentedIndex = 0 The default value is UISegmentedControlNoSegment (no segment selected) until the user touches a segment. Set this property to -1 to turn off the current selection. ...
objective-c,uisegmentedcontrol
The UISegmentedControl does not have an option to do as you have stated. You will have to implement your own custom segmented controller using UIViews, UIButtons, or UILabels, etc.
ios,swift,uisegmentedcontrol,uipageviewcontroller
I think you need to change your code a little bit! In my case I create several vc and put them to one array. func createArrayOfControllers(){ newsLenta = self.storyboard?.instantiateViewControllerWithIdentifier("NewsLentaTableViewController") as NewsLentaTableViewController mainPage = self.storyboard?.instantiateViewControllerWithIdentifier("MainPageTableViewController") as MainPageTableViewController onlinetranslation = self.storyboard?.instantiateViewControllerWithIdentifier("SingleTopicTableViewController") as...
ios,objective-c,uisegmentedcontrol
I deleted the UISegmentControl from the Storyboard and added it programmatically and it works now. Very weird. self.segControl.frame = CGRectMake(35, 100, 200, 50); self.segControl.segmentedControlStyle = UISegmentedControlStylePlain; self.segControl.selectedSegmentIndex = 1; [self.view addSubview:self.segControl]; ...
ios,xcode,uisegmentedcontrol,uicolor
You set the segment control tintColor (color code as per your required). segmentedControl.tintColor = [UIColor colorWithRed:.9 green:.1 blue:.1 alpha:1]; ...
ios,objective-c,uisegmentedcontrol,nslayoutconstraint
Setting the width of the segments does change the visible size of the segmented control, but not the actual size of the control. You can see this by dividing by 5 instead of 3 in your code, and you'll see that the control appears much smaller, but if you click...
ios,objective-c,uisegmentedcontrol
I had the similar need in my previous project and I used the PPiFlatSegmentedControl for it and it works like magic. Thanks, Attiqe...
ios,iphone,uitableview,uisegmentedcontrol,uiswitch
The error seems to be that since iOS 8.1.1, I'm not entering one of my if statement. The cast on NSNumber object fails. When debugging, I got this on iOS 8.1 : (lldb) po quality { segment = 1; title = "Quality"; } (lldb) p (BOOL)[quality valueForKey:@"segment"] (BOOL) $0 =...
objective-c,uitableview,uisegmentedcontrol,segments
No, there is no better way. If all segmented controls have the same number of segments then create the control with that number of segments. Then simply use setTitle:forSegmentAtIndex: to change the title of each segment, one at a time. If the number can change, use removeAllSegments and insertSegmentWithTitle:atIndex:animated:. Or...