Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slight lag after tapping segment? #22

Open
aerose2012 opened this issue Jun 22, 2016 · 9 comments
Open

Slight lag after tapping segment? #22

aerose2012 opened this issue Jun 22, 2016 · 9 comments

Comments

@aerose2012
Copy link

aerose2012 commented Jun 22, 2016

@xaviermerino , it seems for some reason that I have a bit of a lag after tapping a segment. Do you have any idea what could be causing this? No heavy lifting is being done through this transition on the app's end so it shouldn't be slow. I used to have a tab bar controller in its place and it was instantaneous. I LOVE your controller so I want to make it work :). I have included a video below.

xmsegmentedcontrol_lag_issue

@xaviermerino
Copy link
Owner

I've never seen such a thing. Although I've noticed that you have changed the highlight bar's dimensions. (Or is the frame that is not as wide as the parent controller?) Could you send me a code example where you isolate the issue? I'm really intrigued.

@aerose2012
Copy link
Author

aerose2012 commented Jun 22, 2016

Not quite, its actually a bit weird because I wanted it in my navigation bar so i literally set the titleView to it. I don't mess with the titleView anywhere else but it automatically reduces the size of it slightly because as you can see, the controllers view doesn't go all the way to the end of the screen.

let segmentedControl = XMSegmentedControl(frame: CGRectMake(0, 0,     navigationController!.navigationBar.frame.width, navigationController!.navigationBar.frame.height - 2), segmentTitle: ["Services","Appointments"], selectedItemHighlightStyle: XMSelectedItemHighlightStyle.BottomEdge)
    segmentedControl.backgroundColor = UIColor.clearColor()
    segmentedControl.highlightColor = kPrimaryColor//UIColor.lightGrayColor()
    segmentedControl.tint = UIColor.darkGrayColor()
    segmentedControl.highlightTint = kPrimaryColor

    segmentedControl.delegate = self
    navigationItem.titleView = segmentedControl

@xaviermerino
Copy link
Owner

I've used it in the navigation bar before without any issues. You can see from the picture I'm attaching.

If you let me see a portion of the code in which you are embedding it into the navigation bar I could help you figure it out.

Sent from my iPhone

On Jun 22, 2016, at 4:31 PM, aerose2012 [email protected] wrote:

Not quite, its actually a bit weird because I wanted it in my navigation bar so i literally set the titleView to it:

`let segmentedControl = XMSegmentedControl(frame: CGRectMake(0, 0, navigationController!.navigationBar.frame.width, navigationController!.navigationBar.frame.height - 2), segmentTitle: ["Services","Appointments"], selectedItemHighlightStyle: XMSelectedItemHighlightStyle.BottomEdge)
segmentedControl.backgroundColor = UIColor.clearColor()
segmentedControl.highlightColor = kPrimaryColor//UIColor.lightGrayColor()
segmentedControl.tint = UIColor.darkGrayColor()
segmentedControl.highlightTint = kPrimaryColor

segmentedControl.delegate = self
navigationItem.titleView = segmentedControl`


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

@aerose2012
Copy link
Author

I think I included that code in the last comment. Its just one line of code to embed it

navigationItem.titleView = segmentedControl

Is there something else that would be helpful? I am happy to provide it, I super appreciate your willingness to help!

@xaviermerino
Copy link
Owner

I used something like self.navigationController?.navigationBar.addSubview(segmentedControl)

I apologize for the crappy image. Hopefully this will help.

Sent from my iPhone

On Jun 22, 2016, at 5:19 PM, aerose2012 [email protected] wrote:

I think I included that code in the last comment. Its just one line of code to embed it

navigationItem.titleView = segmentedControl
Is there something else that would be helpful? I am happy to provide it, I super appreciate your willingness to help!


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

@aerose2012
Copy link
Author

Interesting, I added it the way you just said and now it spans the entire width of the navigationbar but the lag still exists. So strange, i have NO idea what could be causing this :/.

@xaviermerino
Copy link
Owner

Hmm I'll give it a try again and see if I get a lag. Because I can't get to replicate your issues.

Sent from my iPhone

On Jun 22, 2016, at 5:40 PM, aerose2012 [email protected] wrote:

Interesting, I added it the way you just said and now it spans the entire width of the navigationbar but the lag still exists. So strange, i have NO idea what could be causing this :/.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

@aerose2012
Copy link
Author

aerose2012 commented Jun 24, 2016

@xaviermerino It seems that the segmentedControl might be receiving the touch event slowly. Is it possible that in the navbar, the touch event is taking a while to be passed to the control? I figured this out by putting a breakpoint at the top of func segmentPressed(sender:UIButton) and there was a clear lag between when i tapped the controller and when this method was being called.

@xaviermerino
Copy link
Owner

I have never heard of such a thing. and I'm guessing you haven't played with the user interaction properties and stuff like that in this project, so this shouldn't be an issue. I have my segmented control embedded there just fine. Is there a way for you to send me a small demo of the problem. Like a small project that has that problem. So I can try and figure it out

Sent from my iPhone

On Jun 24, 2016, at 10:13 AM, aerose2012 [email protected] wrote:

@xaviermerino It seems that the segmentedControl might be receiving the touch event slowly. Is it possible that in the navbar, the touch event is taking a while to be passed to the control?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants