Search Results

Search found 57 results on 3 pages for 'uisegmentedcontrol'.

Page 1/3 | 1 2 3  | Next Page >

  • UISegmentedControl is hidden under the titleBar

    - by shay te
    i guess i am missing something with the UISegmentedControl and auto layout. i have a TabbedApplication (UITabBarController), and i created a new UIViewController to act as tab. to the new view i added UISegmentedControl, and place it to top using auto layout. i guess i don't understand completely something , cause the UISegmentedControl is hiding under the titleBar . can u help me understand what i am missing ? thank you . import Foundation import UIKit; class ViewLikes:UIViewController { override func viewDidLoad() { super.viewDidLoad() title = "some title"; var segmentControl:UISegmentedControl = UISegmentedControl(items:["blash", "blah blah"]); segmentControl.selectedSegmentIndex = 1; segmentControl.setTranslatesAutoresizingMaskIntoConstraints(false) self.view.addSubview(segmentControl) //Set layout var viewsDict = Dictionary <String, UIView>() viewsDict["segment"] = segmentControl; //controls self.view.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|-[segment]-|", options: NSLayoutFormatOptions.AlignAllCenterX, metrics: nil, views: viewsDict)) self.view.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("V:|-[segment]", options: NSLayoutFormatOptions(0), metrics: nil, views: viewsDict)) } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } }

    Read the article

  • UISegmentedControl makes UITableView slow/lag?

    - by Zac Altman
    So I have a nicely working UITableView consisting of 3 rows (each including and image, and a varying number of text fields). Now the 4th row has a UISegmentedControl. As soon as I added it, the UITableView lags/jumps/skips. When I take it away again, everything is smooth. How can I add the UISegmentedControl and still have smooth scrolling?

    Read the article

  • UISegmentedControl Best Practice

    - by Neal L
    Hi all, I'm trying to work out the "best" way to use a UISegmentedControl for an iPhone application. I've read a few posts here on stackoverflow and seen a few people's ideas, but I can't quite sort out the best way to do this. The posts I'm referring to are: http://stackoverflow.com/questions/1559794/changing-views-from-uisegmentedcontrol and http://stackoverflow.com/questions/1047114/how-do-i-use-a-uisegmentedcontrol-to-switch-views It would seem that the options are: Add each of the views in IB and lay them out on top of each other then show/hide them Create each of the subviews separately in IB, then create a container in the main view to populate with the subview that you need Set up one really tall or really wide UIView and animate it left/right or up/down depending on the selected segment Use a UITabBarController to swap out the subviews - seems silly For tables, reload the table and in cellForRowAtIndex and populate the table from different data sources or sections based on the segment option selected (not the case for my app) So which approach is best for subview/non-table approaches? Which is the easiest to implement? Could you share some sample code to the approach? Thanks!

    Read the article

  • UISegmentedControl tint color on touch

    - by gotye
    Hey everyone, I have a UISegmentedControl in my app (see code below) : // --------------- SETTING NAVIGATION BAR RIGHT BUTTONS NSArray *segControlItems = [NSArray arrayWithObjects:[UIImage imageNamed:@"up.png"],[UIImage imageNamed:@"down.png"], nil]; segControl = [[UISegmentedControl alloc] initWithItems:segControlItems]; segControl.segmentedControlStyle = UISegmentedControlStyleBar; segControl.momentary = YES; segControl.frame = CGRectMake(25.0, 7, 65.0, 30.0); segControl.tintColor = [UIColor blackColor]; [segControl addTarget:self action:@selector(segAction:) forControlEvents:UIControlEventValueChanged]; if (current == 0) [segControl setEnabled:NO forSegmentAtIndex:0]; if (current == ([news count]-1)) [segControl setEnabled:NO forSegmentAtIndex:1]; // --------------- But I can't make it to show something when you click on it ... It functionnally works perfectly but I would like it to tint to gray when you click on it (but just when you click) ... would that be possible ? Thank you, Gotye.

    Read the article

  • UISegmentedControl with UITableVIew NSRangeException

    - by Vivas
    Hi, I am using one UIViewController as shown: @interface RssViewController : UIViewController <UITableViewDataSource,UITableViewDelegate,BlogRssParserDelegate> I am displaying an RSS feed in the UITableView (in RssViewController) depending on the segment selected on the UISegmentedControl. My app crashes when I scroll the tableview then select another segment of the UISegmentedControl. For example I have two RSS feeds by default I am displaying the RSS feed at segment 0. This feed has 36 rows. The RSS feed that I load at segment 1 has only 5 rows. When I scroll the RSS feed at segment 0 THEN before the scrolling stops I switch to the RSS feed at segment 1 I crash the app with the following error: * Terminating app due to uncaught exception 'NSRangeException', reason: '* -[NSCFArray objectAtIndex:]: index (36) beyond bounds (0)' If I wait till the scrolling on the RSS feed at segment 0 stops THEN select segment 1, everything works fine. How can I stop this crashing? I wanted to reuse the same tableview because only the data changes. I can see that it is crashing because of the row count - I went from 36 rows down to 5 rows BUT how can I fix this? Any help / suggestions would be appreciated.

    Read the article

  • UISegmentedControl not expanding size for navigation bar/very squished

    - by davetron5000
    Running through an iPhone SDK book and one of the examples has me creating a table and then later adding a UISegmentedControl to the table for sorting. I dutifully did this in IB, and it looks great: When I run it in the simulator or my phone, it's totally squished: The buttons work perfectly, it's just they are not sizing according to their content. Any ideas what's going wrong? Here's the attributes I have set:

    Read the article

  • UISegmentedControl selected segment color

    - by Mike
    Is there any way to customize color of selected segment in UISegmentedControl? I've found segmentedController.tintColor property, which lets me customize color of the whole segmented control. The problem is, when I select bright color for tintColor property, selected segment becomes almost unrecognizable (its color is almost the same as the rest of segmented control, so its hard to distinguish selected and unselected segments). So I cannot use any good bright colors for segmented control. The solution would be some separate property for selected segment color but I cannot find it. Did anyone solve this?

    Read the article

  • Nice shadow effect in text (UISegmentedControl)

    - by Matthias
    Hi, I would like to bring some color to the texts of my UISegmentedControl. So, I've searched a bit about this topic, but it seems to be not possible out-of-the-box. But I found this nice blog post (link text), how to build an image out of a custom text and then assign it to the segemented control. Works fine, but the text in these created images do not have this nice little shadow effect as the original ones. So, does anyone know, how to create such a shadow effect? I guess, Apple does the same (building an image for the text) with the standard segmenented control. Thanks for your help. Regards Matthias

    Read the article

  • Replicate UISegmentedControl with UIButtons - iPhone

    - by Sam
    Hi guys, I didnt like the style of UISegmentedControl, hence i tried to change the way it looked, but I couldnt attach images to its buttons. I just didnt change at all. Now i'm looking at how to replicate that function with 4 UIButtons. I've setup 4 UIButtons in interface builder, added different tag numbers to them. What i cannot accomplish is when a button is tapped, it should be "selected" and the other buttons should be Unselected. How can i connect all of them? And if there was a way to change the UISegmented control looks, i would need all this effort. thanks for the help guys this is for iPhone OS

    Read the article

  • UISegmentedControl with custom prev/next buttons

    - by chacha
    Hey, I am trying to reach the following result here I know how to configure the segmented control but I was wondering how to get the same icons ... I tried to do it with photoshop but I just can't manage to achieve the same quality ! I heard there is a possibility to use the "Apple symbols font" available on Mac (which contains these icons), could you show me how to get these symbols ? Or if you have a link to these precise icons (for free) It would be nice too. Thank you, ChaCha

    Read the article

  • UISegmentedControl register taps on selected segment

    - by Jongsma
    Hi, I have a segmented control where the user can select how to order a list. Works fine. However, I would like that when an already selected segment is tapped, the order gets inverted. I have all the code in place, but I don't know how to register the taps on those segments. It seems the only control event you can use is UIControlEventValueChanged, but that isn't working (since the selected segment isn't actually changing). Is there a solution for this? And if so, what is it? Thanks in advance!

    Read the article

  • ios - UISegmentedControl and NSString

    - by Jeff Kranenburg
    Hello I have the following code: if(_deviceSegmentCntrl.selectedSegmentIndex == 0) { deviceOne = [[NSString alloc] initWithFormat:@"string01"]; } if(_deviceSegmentCntrl.selectedSegmentIndex == 1) { deviceOne = [[NSString alloc] initWithFormat:@"string02"]; } if(_deviceSegmentCntrl.selectedSegmentIndex == 2) { deviceOne = [[NSString alloc] initWithFormat:@"string03"]; } NSString *deviceType = [[NSString alloc] initWithFormat:_deviceSegmentCntrl]; I am wanting to have the NSString output the string the user selects in the segmented control. How do I append the initWithFormat: so that it reflects the chosen index? Cheers

    Read the article

  • UISegmentedControl - how to toggle between 2 UITableViews

    - by embedded
    I have a tab bar based application. What is the best way to toggle between 2 different UITableView views? Should I use a wrapper view and add those 2 views to it and depending on which segment was chosen I will show the correct view? Using only one tableView will not work because the layout is different between those 2 tableviews. Thanks

    Read the article

  • How to set image to the UISegmentedControl in iphone?

    - by Warrior
    I am new to iphone development.I have created UISegmentedControl having 2 segments. I want to to display images for each segment instead of title.Here is my code NSArray *itemArray = [NSArray arrayWithObjects: @"segment1", @"segment2", nil]; UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] initWithItems:itemArray]; segmentedControl.frame = CGRectMake(5,100,300,40); segmentedControl.segmentedControlStyle = UISegmentedControlStyleBar; segmentedControl.selectedSegmentIndex = 1; [self.view addSubview:segmentedControl]; [segmentedControl release]; But instead of displaying the title ,segment1 and segment2 it should be replaced with the images i have.Please help me out.Thanks.

    Read the article

  • Setting width of UISegmentedControl after removing a segment

    - by David Foster
    I have a UISegmentedControl of width 280. In code, I need to remove the third segment, set the UISegmentedControl's width to 200 and then re-centralise. By configuring the springs and struts in IB, I have set the segmented control up such that when I set the width directly it will automatically re-centre. However, when setting the width in code, is it true I need to set it via -setFrame? If this is the case, then I also need to set its X origin, which renders my auto-centralising redundant. My code: [segmentedControl removeSegmentAtIndex:2 animated:NO]; [segmentedControl setFrame:CGRectMake(segmentedControl.frame.origin.x + ((segmentedControl.frame.size.width - TWO_SEGMENT_SEGMENTED_CONTROL_WIDTH) / 2), segmentedControl.frame.origin.y, TWO_SEGMENT_SEGMENTED_CONTROL_WIDTH, segmentedControl.frame.size.height)]; This works, but seems hugely overblown for my purposes. Is there really no simpler way to set solely the width of the control in code?

    Read the article

  • How to remove segmentedcontroller from uinavigationcontroller after view pops?

    - by cannyboy
    I'm building a segmented control within my viewDidLoad method, like so: NSArray *tabitems = [NSArray arrayWithObjects:@"ONE", @"TWO", nil]; UISegmentedControl *tabs = [[UISegmentedControl alloc] initWithItems:tabitems]; tabs.segmentedControlStyle = UISegmentedControlStyleBar; tabs.frame = CGRectMake(185.0, 7.0, 130.0, 30.0); tabs.selectedSegmentIndex = 0; [self.navigationController.navigationBar addSubview:tabs]; [tabs release]; But when the user goes Back in the uinavigationcontroller hierarchy, the segmented controller stays on the navigation bar. How would I get rid of it? Or am I doing something fundamentally wrong?

    Read the article

  • Hide Segemented Control on NavBar, then add Title

    - by Jordan Clark
    Basically I have a Segmented Controller on my NavBar right in the middle. What I want to be able to do is hide the Segmented Controller and add a title to the navigation bar. But with my code, the segmented controller is being hidden, but the title will not add, thus leaving a blank NavBar. This is my simple code in .h: IBOutlet UISegmentedControl *toggleDay; IBOutlet UINavigationBar *navBar; And this is my code in my .m: toggleDay.hidden = YES; navBar.topItem.title = @"Title"; Any help would be great thanks!

    Read the article

  • When I select any segment in segmentControll it doesnot show highlighted

    - by rathodrc
    NSArray *itemArray = [NSArray arrayWithObjects:@"one", @"Two", @"Three", nil]; segmentControl = [[UISegmentedControl alloc] initWithItems:itemArray]; segmentControl.frame = CGRectMake(5, 5, 325, 35); segmentControl.segmentedControlStyle = UISegmentedControlStyleBar; segmentControl.tintColor = [UIColor blackColor]; [self changeUISegmentFont:segmentControl]; //[self.view addSubview:segmentControl]; self.navigationItem.titleView = segmentControl; [segmentControl addTarget:self action:@selector(segmentAction:) forControlEvents:UIControlEventValueChanged]; This is my code of segment control and my problem is .. When I select any segment it does not show me that that segment is selected.. I mean it is not shown highlighted.. can Anyone tell me what the problem is??

    Read the article

  • How to set selected segment index in UISegmentedControl? (iPhone SDK)

    - by seanny94
    Hello all! I'm trying to avoid an app crash here... I have a button that will remove a segment from a UISegmentedControl. If that button is pressed and the user has the segment to be removed selected, the segment will remove and no selection will be highlighted. However, when another button is pushed that does an action that retrieves the selectedSegmentIndex, the app crashes. In short: Is there any way to force the selection of a segment in a UISegmentedControl? edit it seems as though the UISegmentedControl is returning a selectedSegmentIndex of -1 when no segment is selected... let's see what I can do from here.

    Read the article

1 2 3  | Next Page >