iltercengiz / icviewpager Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
This is more like a feature request. It would be great if there was an option to have dynamic tab widths, based on the width of the view (textlabel) inside it. That way you could use a calculated width of the label (including font/fontsize) and use this for the width tab itself, varying for each tab.
As I understand it, right now the only way to set the witdh is using ViewPagerOptionTabWidth, but this is fixed for all tabs, right?
Thanks for the great control, I have done your to-do part, let's see if you like it so u can integrate it with yours.
( I dunno much about github so i just put the message here lol )
The lib is really good.
I setup UITableView in each view controller, it seems the table view's frame is fixed in the content view, and the navigation bar looks not transparent when scroll table view.
So how to code in order to keep transparent? Thanks.
I need to make a repaint of the ViewPagerTabsView programatically changing the background colour.
I cannot fond the correct hook.
Any suggestion?
For now the reloadData will reload everything.
But on orientation rotate I actually wanna change the tab width to fit the full width of the window.
Actually even I try to call reloadData it does not call valueForOption to get the dynamic new width.
Thanks.
when I set the color of ViewPagerTabsView in method - (UIColor *)viewPager: colorForComponent: withDefault:
I cannot see the effect of tabs
I have a segmented control with 2 option
In the first option i have 11 elements, in the second option i have 19 elements
I have problem when i used selectTabAtIndex and switch the segmented control
This is the error
Assertion failure in -[UIPageViewController queuingScrollView:didEndManualScroll:toRevealView:direction:animated:didFinish:didComplete:], /SourceCache/UIKit_Sim/UIKit-2903.23/UIPageViewController.m:1866
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'No view controller managing visible view <UIView: 0x8c21140; frame = (0 0; 320 568); autoresize = RM+BM; layer = <CALayer: 0x8c211a0>>'
Thanks!
Do the viewForTabAtIndex and contentViewControllerForTabAtIndex methods recycle views? I'm afraid if I have 100 tabs I might run out of memory if all the views are kept in memory. Thanks!
I'm not exactly sure why, but
[self.pageViewController setViewControllers:@[viewController]
direction:UIPageViewControllerNavigationDirectionReverse
animated:YES
completion:^(BOOL completed) {
weakSelf.animatingToTab = NO;
// Set the current page again to obtain synchronisation between tabs and content
dispatch_async(dispatch_get_main_queue(), ^{
[weakPageViewController setViewControllers:@[weakViewController]
direction:UIPageViewControllerNavigationDirectionReverse
animated:NO
completion:nil];
});
}];
prevents UIViewControllers from being released properly. If you remove the dispatchAsync call, and don't set the current page again, there is no problem.
I'm not so sure I understood what's the use of the second call to setViewControllers anyway (I don't see any difference if it's there or not)
Should be great to have a way to reload the tabs view (as the colour repaint methods you just added).
I have for example the need to modify the tab label when the user makes some specific interaction and I do not want to reload the whole view.
Do you think is possible to add this feature?
Thanks
Please add cocoapods specfile
Thanks :)
This is my first issue I post here on GitHub. I hope i describe it right, if not just ask me.
I am using your ICViewPager in my app and it is working great. The content views are TableVIewControllers that can push a detail view controller. If i navigate back to the ICViewPager and i hit a tab (tapGesture) it crashes in reloadData.
This is because of the following:
When doing the tap it looks for an index of the tapped item. The index is always undefined and there is the crash.
I just did the following in viewWillApepar:
(void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
if (self.tabs == nil)
[self reloadData];
}
Can you implement this in your master?
Hello, i need a little help here: i want to select different tab from other VC, any advices on how to do this? Thanks!
Update: for example, i have ICViewPager with 3 tabs, in 1 tab i have button with action - push VC and inside that pushed VC i have button with action switch to 3 tab, when i'm going back from second VC my ICViewPager must switch to third tab without animation. I accomplish this with sending message to my first VC with ICViewPager ("selectTabAtIndex:" method), but it's switching tabs with animation (not really good looking with pushing action).
Hi
i want to add next and back buttons before and after page numbers. i can't find where to add them and how to declare button actions?
would you just give me the function name where to add buttons
but i don't want to add them in scrollview next & back buttons should be added outside of scrollview
Is there any way to change the tab/page index programmatically?
In some situations I'd like to force it back to the first tab, without the user having to do this manually.
Hi, In the data source, I use a NavigationController.Looks like below:
When I push to the next Controller,the tab show again.I want to hide it.How can I do?
Hi! @monsieurje
How to get to pan gesture to control side left or right?
Jack
Hi,
I'm create UIScrollView in View but UIScrollView not scroll.
Thank you.
the code
- (UIViewController *)viewPager:(ViewPagerController *)viewPager contentViewControllerForTabAtIndex:(NSUInteger)index {
AMSettingsViewController *settings = [[AMSettingsViewController alloc]init];
UINavigationController *navigationController = [[UINavigationController alloc]initWithRootViewController:settings];
[[navigationController navigationBar] setTranslucent:YES];
return navigationController;
}
when the app first launched the height of the navigation bar is higher. but when switch to next tab, the height simply shrinks. Is this a bug? thanks.
I'm getting this exception when I swipe too fast:
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]'
I found it's crashing at line 341 of ViewPagerController.m:
[self.pageViewController setViewControllers:@[viewController]
direction:(activeContentIndex < self.activeContentIndex) ? UIPageViewControllerNavigationDirectionReverse : UIPageViewControllerNavigationDirectionForward
animated:YES
completion:^(BOOL completed) {
weakSelf.animatingToTab = NO;
// Set the current page again to obtain synchronisation between tabs and content
dispatch_async(dispatch_get_main_queue(), ^{
[weakPageViewController setViewControllers:@[viewController]
direction:(activeContentIndex < weakSelf.activeContentIndex) ? UIPageViewControllerNavigationDirectionReverse : UIPageViewControllerNavigationDirectionForward
animated:NO
completion:nil];
});
}];
And the reason is that viewController is nil.
Can you fix this? Maybe make a check to see if the viewController is nil?
Thanks!
ICViewPager in CocoaPods's Specs no update to support iOS 6.0
https://github.com/CocoaPods/Specs/blob/master/ICViewPager/1.5/ICViewPager.podspec
Say for example I want to init the pager at a given index. Is that possible? Thanks
Looks like the tabs method is not visible so I wonder how is possible to act on the selected label via delegate:
- (void)viewPager:(ViewPagerController *)viewPager didChangeTabToIndex:(NSUInteger)index1 {
}
How may I access the selected tab view using the index if I cannot see the tabs array?
I'm trying to make ICViewPager work with SWRevealViewController.
In the - (UIViewController *)viewPager:(ViewPagerController *)viewPager contentViewControllerForTabAtIndex:(NSUInteger)index
method I'm trying to instantiate a navigation controller and a child:
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:vc];
ABIMediaFilesViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"mediaFilesController"];
[revealController setFrontViewController:vc animated:YES];
It kinda works, but the navigation labels of ICViewPager are not being shown, I guess that's because a navigation controller just overrides everything on screen.
It is possible to have nav controllers in content view or am I doing something wrong?
Thanks
Any Chance to add Image and Label on ViewPagerController (Bottom Menu)
I was playing around with ICViewPager and it caused quite a few crashes. The tabs in my implementation are collectionViews
2013-09-27 14:19:09.741 SenseiSpanish[36857:a0b] <_UIPageViewControllerContentView: 0xa39d3a0; frame = (0 44; 320 460); clipsToBounds = YES; opaque = NO; autoresize = W+H; tag = 34; layer = <CALayer: 0xa387bb0>>
2013-09-27 14:19:10.045 SenseiSpanish[36857:a0b] *** Assertion failure in -[_UIQueuingScrollView _didScrollWithAnimation:force:], /SourceCache/UIKit_Sim/UIKit-2903.2/_UIQueuingScrollView.m:799
2013-09-27 14:19:15.076 SenseiSpanish[36857:a0b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Failed to determine navigation direction for scroll'
*** First throw call stack:
(
0 CoreFoundation 0x0212b5e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x01bd98b6 objc_exception_throw + 44
2 CoreFoundation 0x0212b448 +[NSException raise:format:arguments:] + 136
3 Foundation 0x0159923e -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 116
4 UIKit 0x00d3573b __54-[_UIQueuingScrollView _didScrollWithAnimation:force:]_block_invoke + 260
5 UIKit 0x00d352f8 -[_UIQueuingScrollView _didScrollWithAnimation:force:] + 541
6 UIKit 0x00d31037 -[_UIQueuingScrollView _scrollViewAnimationEnded:finished:] + 104
7 UIKit 0x007bcecb -[UIScrollView(UIScrollViewInternal) animator:stopAnimation:fraction:] + 62
8 UIKit 0x00826f8e -[UIAnimator stopAnimation:] + 533
9 UIKit 0x0082762a -[UIAnimator(Static) _advanceAnimationsOfType:withTimestamp:] + 325
10 UIKit 0x00827196 -[UIAnimator(Static) _LCDHeartbeatCallback:] + 67
11 QuartzCore 0x0062dfca _ZN2CA7Display15DisplayLinkItem8dispatchEv + 48
12 QuartzCore 0x0062de86 _ZN2CA7Display11DisplayLink14dispatch_itemsEyyy + 310
13 QuartzCore 0x0062e3ab _ZN2CA7Display16TimerDisplayLink8callbackEP16__CFRunLoopTimerPv + 123
14 CoreFoundation 0x020e9c46 CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION + 22
15 CoreFoundation 0x020e962d __CFRunLoopDoTimer + 1181
16 CoreFoundation 0x020d1698 __CFRunLoopRun + 1816
17 CoreFoundation 0x020d0b33 CFRunLoopRunSpecific + 467
18 CoreFoundation 0x020d094b CFRunLoopRunInMode + 123
19 GraphicsServices 0x024159d7 GSEventRunModal + 192
20 GraphicsServices 0x024157fe GSEventRun + 104
21 UIKit 0x0072b94b UIApplicationMain + 1225
22 SenseiSpanish 0x00002d1d main + 141
23 libdyld.dylib 0x03030725 start + 0
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
I've 3 UITableViewController's. None of them responds to status bar tap for scrolling to top. How can I accomplish this?
There is a accepted pull request for this issue #31 but I couldn't solve the problem.
Index often incorrect.
Is possible to determine the position of the tab?
I need a space between the navbar and tab for a segmented control
Thanks!
Hi thanks for the update,
Can you please give example on how to change indicator color?
and how to override the tab width?
Thank you
Hello,
I am implementing ICViewPager code in Tab group Tab. Initially it is working fine . when user change tabs and agin go to his/her existing tab in which ICViewPager code is implementing page having issue. Only two TabView are shown on screen when we are are scrolling this page nothing happens , But we are tab on on All or Book it is working
Scrolling is not working but we are click on any tabs [All , book etc] ICViewPager code is working fine. I am facing scrolling issue.
Please check this issue.
Is there a way to load the view controllers of the adjacent tabs? That would make the swiping more fluid.
contentViewControllerForTabAtIndex is only called when the tab is selected.
I am trying to using your control and it works smoothly.
I just face one issue. Before I call my feeds data, ViewPagerController delegate are getting called. At that time I have feeds as null.
Crash I get is at below line in ViewPagerController
[self.pageViewController setViewControllers:@[viewController]
direction:UIPageViewControllerNavigationDirectionForward
animated:NO
completion:nil];
In Log, I see below details.
2013-11-20 15:54:52.476 Garage[1517:a0b] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[**NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]'
* First throw call stack:
(
0 CoreFoundation 0x01fa05e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x019f48b6 objc_exception_throw + 44
2 CoreFoundation 0x01f54386 -[__NSPlaceholderArray initWithObjects:count:] + 390
3 CoreFoundation 0x01f66dc2 +[NSArray arrayWithObjects:count:] + 66
4 Garage 0x000a38ac -[ViewPagerController setActiveContentIndex:] + 316
5 Garage 0x000a5b5e -[ViewPagerController selectTabAtIndex:] + 94
6 Garage 0x000a9624 -[ViewPagerController defaultSetup] + 8660
7 Garage 0x000a0939 -[ViewPagerController viewWillAppear:] + 137
8 Garage 0x00055682 -[DirectoryViewController viewWillAppear:] + 98
9 UIKit 0x0087e28a -[UIViewController _setViewAppearState:isAnimating:] + 419
10 UIKit 0x0087e695 __52-[UIViewController _setViewAppearState:isAnimating:]_block_invoke + 325
11 CoreFoundation 0x0201d05d __53-[__NSArrayI enumerateObjectsWithOptions:usingBlock:]_block_invoke + 61
12 CoreFoundation 0x0201cf92 -[__NSArrayI enumerateObjectsWithOptions:usingBlock:] + 258
13 CoreFoundation 0x01f9a0a5 -[NSArray enumerateObjectsUsingBlock:] + 53
14 UIKit 0x0087e444 -[UIViewController _setViewAppearState:isAnimating:] + 861
15 UIKit 0x0087e798 -[UIViewController __viewWillAppear:] + 114
16 UIKit 0x0088f310 -[UIViewController(UIContainerViewControllerProtectedMethods) beginAppearanceTransition:animated:] + 199
17 UIKit 0x00894b8e -[UINavigationController _startCustomTransition:] + 1062
18 UIKit 0x008a1757 -[UINavigationController _startDeferredTransitionIfNeeded:] + 688
19 UIKit 0x008a2349 -[UINavigationController __viewWillLayoutSubviews] + 57
20 UIKit 0x009db39d -[UILayoutContainerView layoutSubviews] + 213
21 UIKit 0x007d1dd7 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355
22 libobjc.A.dylib 0x01a0681f -[NSObject performSelector:withObject:] + 70
23 QuartzCore 0x0043472a -[CALayer layoutSublayers] + 148
24 QuartzCore 0x00428514 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
25 QuartzCore 0x00428380 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
26 QuartzCore 0x00390156 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294
27 QuartzCore 0x003914e1 _ZN2CA11Transaction6commitEv + 393
28 QuartzCore 0x00391bb4 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
29 CoreFoundation 0x01f6853e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 30
30 CoreFoundation 0x01f6848f __CFRunLoopDoObservers + 399
31 CoreFoundation 0x01f463b4 __CFRunLoopRun + 1076
32 CoreFoundation 0x01f45b33 CFRunLoopRunSpecific + 467
33 CoreFoundation 0x01f4594b CFRunLoopRunInMode + 123
34 GraphicsServices 0x02f399d7 GSEventRunModal + 192
35 GraphicsServices 0x02f397fe GSEventRun + 104
36 UIKit 0x0076794b UIApplicationMain + 1225
37 Garage 0x00026e32 main + 130
38 libdyld.dylib 0x06559725 start + 0
)
libc++abi.dylib: terminating with uncaught exception of type NSException
To test in your app, you can make below change
return 0; is the change.
Also as an future, you can add also below point (as per our email conversation).
If some tab is selected, text of that tab get's changed.
Hi,
Im wondering if theres anyway to implement m:n tabs:views (where m < n). An example would be say I have three 'categories' of food (say italian,indian,chinese) but have many views inside each. As of now, there seems to be a 1:1 mapping between tabs and views. What would be the best way to hack up an m:n system - a) wherein the tabs are programmatically changed on sliding b)Clicking on a particular tab goes to some arbitrary index c) No of views is of course greater than no. of tabs.
Am not worried about handling the counters/logic - its just that the interface/protocol doesnt seem to be open to this. I could achieve this in Android (tabbed-viewpager) though.
Hi,
If you tap on a tab while you sliding the pager, the app crashes.
I spent few hours to try fix it but nothing.
Does someone succeed ?
Thx,
There is a space between the navigationbar and the pageviewer bar. What can I do about this?
When the app launches it takes time to load the tabs, if I swipe before loading views, there is a crash.
Also it takes time to load the initial view.
Thanks
2014-03-26 18:22:25.547 ICViewPager[12344:90b] *** Assertion failure in -[UIPageViewController queuingScrollView:didBailoutOfScrollAndRevealedView:], /SourceCache/UIKit_Sim/UIKit-2935.137/UIPageViewController.m:1894
Is there way to load for example 5th tab on first load?
I'm trying to do this by adding selectTabAtIndex: in viewDidLoad method, but i'm getting error:
-[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]'.
I guess problem is that content of tab that i'm trying to select on initial load is not yet created.
Any advice how can i fix this issue?
Thanks!
This is a minor actually but could you remove the one and only NSLog in your file? Apple docs says it for "error message" purpose (https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Functions/Reference/reference.html#//apple_ref/c/func/NSLog)
I am getting an error on continued scroll between tabs. I have limited the tab count to 3.
The error is : Assertion failure in -[_UIQueuingScrollView _replaceViews:updatingContents:adjustContentInsets:animated:], *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: [views count] == 3
Please help
Hi,
How to set background image in ViewPagerController Class?
Thank you!
ViewPagerOptionStartFromSecondTab can have two values: 0.0 or 1.0 and thats great! After analyzing your code i have found this:
// so here you load view controller from index 1 or 0
if ([self.startFromSecondTab boolValue]) {
viewController = [self viewControllerAtIndex:1];
} else {
viewController = [self viewControllerAtIndex:0];
}
...
// and here you are setting active tab with unsigned int
self.activeTabIndex = [self.startFromSecondTab unsignedIntegerValue];
When I set ViewPagerOptionStartFromSecondTab to 5.0 it will select tab number 5 but still load view controller number 1, so this is some kind of bug. You could change/add option to ViewPagerOptionStartFromTabIndex and here would be a numeric value from which start view controller would be launched.
The code could look like this:
NSUInteger startTabIndex = [self.startFromTabIndex unsignedIntegerValue];
if (startTabIndex > 0 && startTabIndex < [self.contents count]) {
viewController = [self viewControllerAtIndex:startTabIndex];
}
when pager scrolling quickly, activeContentIndex set invalid value.
like [activeContentIndex NSUInteger 2147483647 2147483647]
i'm trying to fix this problem,but can't solve this problem now.
if you can, i hope you fix this problem,regards.
Hi. I just noticed a memory leak.
In the ViewPagerController class, allocation type is not defined for delegates.
So:
@Property id dataSource;
@Property id delegate;
Are treated as strong properties.
Which means, if you create a class (like in the demo, HostViewController) that extends ViewPagerController and is it's self delegate, it won't be able to release itself.
You should decleare this properties as weak
@Property (weak) id dataSource;
@Property (weak) id delegate;
@monsieurje
Hi!
When I quickly / fast scroll viewpager, do not need to immediately call viewDidAppear method, called only stop sliding viewDidAppear method.
Can you help me ?
Jack
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.