ios - fading scrollMenu with labels -



ios - fading scrollMenu with labels -

i've created paged uiscrollview contains labels on every page. how can lower margin between labels in image , still beingness able scroll?

at moment navigationbar following. u can swipe next page right , next label.

what want little margin , still beingness able swipe.

viewdidload code //category scrollview categoryscrollview = uiscrollview(frame: cgrectmake(0, self.navigationcontroller!.navigationbar.frame.height-38, self.view.frame.width, 38)) categoryscrollview?.contentsize = cgsizemake(self.view.frame.width, 38) categoryscrollview?.delegate = self categoryscrollview?.pagingenabled = true self.navigationcontroller?.navigationbar.addsubview(categoryscrollview!) categoryarray = nsarray(objects: "book", "elektronik") var textwidth = 0 val in categoryarray! { var textlabel: uilabel = uilabel() textlabel.textalignment = nstextalignment.center textlabel.text = val nsstring textlabel.frame = cgrectmake(cgfloat(textwidth), 0, categoryscrollview!.frame.width, categoryscrollview!.frame.height) categoryscrollview?.addsubview(textlabel) textwidth = textwidth + int(textlabel.frame.size.width) if textwidth > int(self.view.frame.width) { categoryscrollview?.contentsize = cgsizemake(cgfloat(textwidth), categoryscrollview!.frame.height); } }

the default width of "page" when pagingenabled switched on width of scroll view. cut down width , allow contained views visible beyond edges of view setting clipstobounds false.

if not work there alternative adjust paging width intercepting end of drag via uiscrollviewdelegate method scrollviewwillenddragging(...) can adjust targetcontentoffset fit needs (see illustration here).

ios objective-c iphone swift uiscrollview

Comments

Popular posts from this blog

c - Compilation of a code: unkown type name string -

java - Bypassing "final local variable defined in an enclosing type" -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -