Git Product home page Git Product logo

slpagingview's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

slpagingview's Issues

NavigationBar display issue

Hello, I got some displaying issue in the navigation bar please check the image 'I want my nav bar looks like twitter'
capture d ecran 2015-03-17 a 10 21 57

Also My CollectionView was resizing when rotating but after adding SLPagingView it doesn't resize any more I tried to add this code to didLoadView method in SLpagingView but haven't helpd :

self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth |
    UIViewAutoresizingFlexibleHeight;

I'm using storyboard as in tinder example (and I'haven't added any code) I just subclassed from SLPagingView and I add the costum Segue that's all

View Controllers get deallocated

When I present the paging view with my three view controllers, they are all deallocated. Is there a reason they are not kept around?

Show View Controllers instead of Colors

How can I set this to show my view controllers instead of showing the UIColors

I was thinking that I would be able to do it in the views NSArray

NSArray *titles = @[[[UIImageView alloc] initWithImage:img1], [[UIImageView alloc] initWithImage:img2], [[UIImageView alloc] initWithImage:img3]];
NSArray *views = @[[self viewWithBackground:orange], [self viewWithBackground:[UIColor yellowColor]], [self viewWithBackground:gray]];

SLPagingViewController *pageViewController = [[SLPagingViewController alloc] initWithNavBarItems:titles
                                                                                navBarBackground:[UIColor whiteColor]
                                                                                           views:views
                                                                                 showPageControl:NO];

Is there a way to add a button to the nav bar?

Is there a way to add a button to the nav bar that responds to a selector as opposed to being another view than you can swipe to? And it will only appear on the farthest right view in the SLPagingView?

Unable to install pod

This possibly could be my install of cocoa pods is messed up but it is unlikely. I am unable to install this via cocoa pods from github or just by refrencing

pod 'SLPagingView'

i have also tried referencing the github repository

pod 'SLPagingView', :git => 'https://github.com/StefanLage/SLPagingView.git'

I have spend quite awhile trying to rule out my cocoa pods install but i have successfully installed other pods.

Any help would be appreciated. Thanks for this awesome control!

screen shot 2015-08-25 at 7 20 57 am
screen shot 2015-08-25 at 7 20 42 am

PickerView goes nuts inside SLPagingView

I've been having an issue using the standard PickerView (spinning wheel) not only inside one of the view controllers under the purview of SLPagingViewController, but also inside of modal popups that seems shouldn't be affected by it. Basically, the spinning-wheel wobbles in every possible direction, doesn't rotate properly at all, with tapping (not swiping/spinning) being the only way to select a value.

Below are the screenshots of how it looks when you try to spin it. To experience, simply add the most basic PickerView implementation to the TinderStoryboard example (code below).
Any thoughts on how to fix this would be helpful since I'm yet to find a solution/cause.

ios simulator screen shot jun 29 2015 13 17 08
ios simulator screen shot jun 29 2015 13 17 01
ios simulator screen shot jun 29 2015 13 16 57

CODE:

  • drop PickerView onto Profile page and link it to the ProfileController through IB to a "pickerView" variable
- (void)viewDidLoad {
    [super viewDidLoad];
    UIImage *logo = [UIImage imageNamed:@"profile"];
    logo = [logo imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
    _titleView = [[UIImageView alloc] initWithImage:logo];
    self.navigationItem.titleView = self.titleView;
    // Do any additional setup after loading the view, typically from a nib.

    self.pickerView.delegate = self;
    self.pickerView.dataSource = self;
    _pickerData = @[@"Item 1", @"Item 2", @"Item 3", @"Item 4", @"Item 5", @"Item 6"];
}

NSArray *_pickerData;

- (int)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
    return 1;
}

- (int)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
{
    return _pickerData.count;
}

- (NSString*)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
    return _pickerData[row];
}

Not seeing tabs when I used the SLPagingViewController inside a ViewController

I have an iOS app where ViewController is the default view controller. The implementation of ViewController looks like this

#import "ViewController.h"
#import "SLPagingViewController.h"
#import "UIColor+SLAddition.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.

}

- (void)viewDidAppear:(BOOL)animated {
    UIColor *orange = [UIColor colorWithRed:255/255
                                      green:69.0/255
                                       blue:0.0/255
                                      alpha:1.0];

    UIColor *gray = [UIColor colorWithRed:.84
                                    green:.84
                                     blue:.84
                                    alpha:1.0];

    UIImage *img1 = [UIImage imageNamed:@"gear"];
    img1 = [img1 imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];

    UIImage *img2 = [UIImage imageNamed:@"profile"];
    img2 = [img2 imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];

    UIImage *img3 = [UIImage imageNamed:@"chat"];
    img3 = [img3 imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];

    NSArray *titles = @[[[UIImageView alloc] initWithImage:img1], [[UIImageView alloc] initWithImage:img2], [[UIImageView alloc] initWithImage:img3]];

    UIView *orangeView = [self viewWithBackground:[UIColor orangeColor]];

    UIView *yellowView = [self viewWithBackground:[UIColor yellowColor]];

    UIView *blueView = [self viewWithBackground:[UIColor blueColor]];

    NSArray *views = @[orangeView, yellowView, blueView];


    SLPagingViewController *pageViewController = [[SLPagingViewController alloc] initWithNavBarItems:titles
                                                                                    navBarBackground:[UIColor whiteColor]
                                                                                               views:views
                                                                                     showPageControl:NO];


    pageViewController.navigationSideItemsStyle = SLNavigationSideItemsStyleOnBounds;
    float minX = 45.0;
    // Tinder Like
    pageViewController.pagingViewMoving = ^(NSArray *subviews){
        float mid  = [UIScreen mainScreen].bounds.size.width/2 - minX;
        float midM = [UIScreen mainScreen].bounds.size.width - minX;
        for(UIImageView *v in subviews){
            UIColor *c = gray;
            if(v.frame.origin.x > minX
               && v.frame.origin.x < mid)
                // Left part
                c = [UIColor gradient:v.frame.origin.x
                                  top:minX+1
                               bottom:mid-1
                                 init:orange
                                 goal:gray];
            else if(v.frame.origin.x > mid
                    && v.frame.origin.x < midM)
                // Right part
                c = [UIColor gradient:v.frame.origin.x
                                  top:mid+1
                               bottom:midM-1
                                 init:gray
                                 goal:orange];
            else if(v.frame.origin.x == mid)
                c = orange;
            v.tintColor= c;
        }
    };



    [pageViewController setNavigationBarColor:[UIColor greenColor]];

    [self presentViewController:pageViewController animated:YES completion:nil];
}

-(UIView*)viewWithBackground:(UIColor *)color{
    UIView *v = [UIView new];
    v.backgroundColor = color;
    return v;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

However, with the above code, the orange, yellow and blue views fill the whole screen and the tabs are not visible. How do I make the tabs visible?

Twitter style other title appears on screen

I'm trying to have a twitter style headers (titles replacing one another).
I'm using storyboard controllers.
When the view loads I get this image:
screen shot 2015-04-12 at 12 21 09 am
When I just touch the swipe, I get what I expected to see - the "Feedme" title disappears (appears nicely when actually swiping to the second controller) - like so:
screen shot 2015-04-12 at 12 21 19 am

How can I make it appear correctly on initial load.

The code:

    MainTabBarViewController *c = [self.storyboard instantiateViewControllerWithIdentifier:@"tabBarController"];
    c.selectedIndex = 1; //feed
    UINavigationController *nav = (UINavigationController *)[c.childViewControllers objectAtIndex:1];
    SLPagingViewController *pageViewController = (SLPagingViewController *)[nav.viewControllers objectAtIndex:0];
    pageViewController.navigationSideItemsStyle = SLNavigationSideItemsStyleDefault;

    pageViewController.pagingViewMovingRedefine = ^(UIScrollView *scrollView, NSArray *subviews){
        float mid   = [UIScreen mainScreen].bounds.size.width/2 - 45.0;
        float width = [UIScreen mainScreen].bounds.size.width;
        CGFloat xOffset = scrollView.contentOffset.x;
        int i = 0;
        for(UILabel *v in subviews){
            CGFloat alpha = 0.0;
            if(v.frame.origin.x < mid)
                alpha = 1 - (xOffset - i*width) / width;
            else if(v.frame.origin.x >mid)
                alpha=(xOffset - i*width) / width + 1;
            else if(v.frame.origin.x == mid-5)
                alpha = 1.0;
            i++;
            v.alpha = alpha;
        }
    };

    [pageViewController setCurrentIndex:0 animated:NO];
    pageViewController.needToShowPageControl = YES;

    dispatch_async(dispatch_get_main_queue(), ^{
        [self presentViewController:c animated:YES completion:nil];
    });

How to make a "complicated" twitter like case

(label it a question)

I have 2 ViewControllers to use.
Basically they contain only a UITableView - like the twitter example - but the thing is that they are completely different (which is not a problem, the delegates can handle it with conditions)
But has a lot of extra functionality (catch click on the UITabBar to refresh and scroll up, swipe up to refresh etc.)

I'm having trouble understanding what should I implement - can I have my UIViewController subclass SLPagingViewController?
(I can't just add tableview views like the example - it's not enough)

Or should I have 2 UIViewControllers (like the tinder example) and make them share relevant code outside the logic of SLPagingViewController?

Views got pushed down

Hi, I tried to use this and wonder how can I set the navigation bar translucent? I saw that there is a navigationBarView of SLPagingViewController, and all the views got pushed down by the navigation bars. Is that the reason?
screenshot 2015-04-25 01 16 12
Thanks for help.

self.navigationController is null from the page

I'got project that's look like this :
5605b850-b8f2-11e4-93b6-8b7bd1fea5a3

So the problem if I try to push view from one of the pager View (the red or yellow one ...) it won't work because self.navigationController is null, how to fix it ? {code Example to push view from the yellow screen}

    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main"bundle:nil];
    PostReaderViewController *postReaderView =
    (PostReaderViewController *)
    [storyboard instantiateViewControllerWithIdentifier:@"postReaderView"];
    NSLog(@"%@", self.navigationController);
    [self.navigationController pushViewController:postReaderView animated:YES];

Navigation bar background color

Hi,

I was wondering if there is a way to change the navigation bar's background color using Storyboard. I saw that you manage it in navigationBarView but it's a private property, I can't change.

Thanks for the great work!

How do you use this in a navigation controller

Im trying to use this in a navigation controller. I present a login page and after the user logs in I present my SLPagingView, but when it gets presented self.navigationController is null so I cant push anything else.
I've looked at #19, but thats still not working for me.

I've tried everything, please help!

Please can You explain me how can I notice me about changing the viewController?

I'm new in iOS development. I see this in .h
/*

  • Block delegates
    */
    typedef void(^SLPagingViewMoving)(NSArray *subviews);
    typedef void(^SLPagingViewMovingRedefine)(UIScrollView * scrollView, NSArray *subviews);
    typedef void(^SLPagingViewDidChanged)(NSInteger currentPage);

Please can You explain me how I can notice me about changing the viewController using this blocks?

I've implement this in my appDelegate:

pageViewController.didChangedPage = ^(NSInteger interr) {
    NSLog(@"SOMETHING");

    [[NSNotificationCenter defaultCenter] postNotificationName:@"Sergey" object:nil userInfo:nil];
    NSLog(@"%i", interr);

};

(use this in demo app in appDelegate).
I've implement notification and addObserver in another controller but nothing happen. And all three controllers dealloc.
And how can I call viewDidAppear from my controller.
And also I notice that this block return me number 1 and 2. And did't return the number of my first controller. Is it the bug?

How can I say my controller that it is now display on the screen and it should be update?

WKWebView can't handle combo box correctly

Hi. I had to remove SLPagingView from my project because of this behaviour. It's hard to explain but, basically, when loading a html with a combo box (select element) within it, you can't select any option because every time you scroll the Picker View that appears at the bottom and lift your finger, the default option is selected; though if you tap an directly to an option it works but it is not the intended behaviour of a Picker View. Also the Picker View can be scrolled to the left and to the right and then it returns to the correct position but with the same bad behaviour.

To replicate this, just create a brand new project, pod install SLPagingView and use this code in the ViewController.m:

#import <WebKit/WebKit.h>
.
.
.
@interface ViewController ()

@property (strong, nonatomic) WKWebView *theWebView;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    _theWebView = [[WKWebView alloc] initWithFrame:self.view.frame];
    [self.view addSubview:_theWebView];
    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.example.com/some_html_with_select_element.html"]];
    [_theWebView loadRequest:request];
}

Fortunately, the project I'm working on wasn't making use of SLPagingView so I could removed it.

Not supporting a new devices

How can I support a new iOS devices as Xs, Xs Max, XR? Bcouz right now I get the next picture:
image
Any solution to figured out it?

using the library with sotryboard

Hello, I'm trying to use this library in storybord so I've designed my different views in storyBorad then I added this code in app delegate :

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    SubBaseCollection2 *view1 = (SubBaseCollection2 *)[storyboard instantiateViewControllerWithIdentifier:@"subView2"];
    SubBaseCollection *view2 = (SubBaseCollection *)[storyboard instantiateViewControllerWithIdentifier:@"subView1"]; 
    UIViewController *view3 =  (UIViewController *)[storyboard instantiateViewControllerWithIdentifier:@"subView3"];
    SLPagingViewController *pageViewController = [[SLPagingViewController alloc] initWithNavBarControllers:@[view3, view1, view2]];
    UINavigationController *navC = [[UINavigationController alloc] initWithRootViewController:pageViewController];
    self.window.rootViewController = navC;

This work when I navigate to right but If I go back my app crash.
capture d ecran 2015-03-13 a 11 00 32

check My sample code over here : https://drive.google.com/file/d/0Bx1q874uh9xwZVJNdlZRejRQM00/view?usp=sharing

Use without auto layout?

Wondering if we can use this without auto constraints? I'm going to be targeting only the iPhone 5 screen so using autoresizing masks (springs/struts) is much faster than setting up constraints.

I tried using it without auto constraints, but I'm getting this error:

The view hierarchy is not prepared for the constraint: <NSLayoutConstraint:0x7d166fe0 H:[UIView:0x7d160ef0]-(0)-[UIView:0x7d161970]>
    When added to a view, the constraint's items must be descendants of that view (or the view itself). This will crash if the constraint needs to be resolved before the view hierarchy is assembled. Break on -[UIView _viewHierarchyUnpreparedForConstraint:] to debug.
Assertion failure in -[UIScrollView _layoutEngine_didAddLayoutConstraint:roundingAdjustment:mutuallyExclusiveConstraints:], /SourceCache/UIKit_Sim/UIKit-3318.16.14/NSLayoutConstraint_UIKitAdditions.m:560
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Impossible to set up layout with view hierarchy unprepared for constraint.'

Issue with Two Pointers

I'm not sure if this was a typo or what, but you've set up these two pointers like so

typedef void(^SLPagingViewMoving)(NSArray *subviews);
typedef void(^SLPagingViewMovingRedefine)(UIScrollView *scrollView, NSArray *subviews);

But your referencing one like this

pageViewController.pagingViewMoving = ^(UIScrollView _scrollView, NSArray *subviews){
CGFloat xOffset = scrollView.contentOffset.x;
int i = 0;
for(UILabel v in subviews){
CGFloat alpha = 0.0;
if(v.frame.origin.x < 145)
alpha = 1 - (xOffset - i_320) / 320;
else if(v.frame.origin.x >145)
alpha=(xOffset - i
320) / 320 + 1;
else if(v.frame.origin.x == 140)
alpha = 1.0;
i++;
v.alpha = alpha;
}
};

which throws a Fatal Error in Xcode 6 because the block your referencing doesn't contain "scrollView"

View Controller containment is broken

UIViewController lifecycle events (view[Will | Did][Load | Appear | Disappear]) should not be sent manually but handled with the View Controller Containment API (willMoveToParentViewController, addChildViewController, didMoveToParentViewController)

self.didChangePage not being called in iOS 9

This was working fine until I tried it on an iOS 9 device. The pageControl also is not updating where it was working fine before I tried iOS 9. Any thoughts?

    __weak typeof(self)weakSelf = self;
    self.didChangedPage = ^(NSInteger currentPageIndex) {
        // do something
        NSLog(@"page index: %i | scrollView: %@", (int)currentPageIndex, NSStringFromCGRect(weakSelf.scrollView.frame));
    };

Using with Storyboard/Login view first then calling for SLPagingView

Hello, I am new to iOS development and honestly not sure where to start with what I'm attempting to build or how to phrase my question. I have a login page and once a user logs in I'd like to call for this type of paging. How would I go about doing so, making SLPagingView once a user logs in instead of in the app delegate file

How can I change a specific nav bar item after init the view controller.

Hello,

Like tinder, when user is on a page, I'd like to change the bar item to a UILabel (previously is a UIImage).

  1. How can I change that specific bar item without re-init the view controller?

2.Where should i change the bar item, didChangePage block or pagingViewMovingRedefine block?

Thanks in advance.

The pushed uitableviewcontroller has wrong contentSize

I have integrated SLPagingView in one of my viewcontroller by inheriting from SLPagingViewController.
Now I tried to push another ViewController from this one and the pushed one had wrong contentsize - (1135, 504) and it can be moved horizontally when dragging.

Very weird.

Couldn't correct implement with controllers.

Please can You explain me what I do wrong?
In my appDelegate

import "AppDelegate.h"

import "SLPagingViewController.h"

import "ChatViewController.h"

import "ProfileViewController.h"

import "SettingsViewController.h"

import "MainViewController.h"

@interface AppDelegate ()

@EnD

@implementation AppDelegate

  • (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.

    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];

    ChatViewController *chat = (ChatViewController *)[storyboard instantiateViewControllerWithIdentifier:@"Chat"];
    ProfileViewController *profile = (ProfileViewController *)[storyboard instantiateViewControllerWithIdentifier:@"Profile"];
    SettingsViewController *settings = (SettingsViewController *)[storyboard instantiateViewControllerWithIdentifier:@"Settings"];

    SLPagingViewController *pageViewController = [[SLPagingViewController alloc] initWithNavBarControllers:@[settings, chat, profile]];

    UINavigationController *navC = [[UINavigationController alloc] initWithRootViewController:pageViewController];

    //UINavigationController *nc = [[­UINavigationController alloc] initWithRootViewController:pageViewController];

    //self.window.rootViewController = pageViewController;
    self.window.rootViewController = navC;

    return YES;
    }

Then in my ChatController:
-(void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
NSLog(@"APPEAR");
}

-(void)dealloc{
NSLog(@"DEALLOC");
}

and in my console I see only DEALLOC. And APPEAR I didn't see.
Please explain what I am doing wrong?

Add ability to hide the navigationBarView

I'm looking to use SLPagingView on the top level of a UINavigationController stack, but hide it on all others. I've been playing with the implementation and I've found that by exposing the navigationBarView, I can hide this when necessary. I can create a pull request with the fix, but I wanted to get your thoughts on exposing this otherwise private attribute.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.