ICViewPager icon indicating copy to clipboard operation
ICViewPager copied to clipboard

Space Between the NavigationBar and the Page Viewer Bar

Open metinsay opened this issue 11 years ago • 10 comments

There is a space between the navigationbar and the pageviewer bar. What can I do about this?

metinsay avatar Nov 13 '13 15:11 metinsay

Can you provide a screenshot please?

— Ilter Cengiz [email protected]

On Wed, Nov 13, 2013 at 5:55 PM, metinsay [email protected] wrote:

There is a space between the navigationbar and the pageviewer bar. What can I do about this?

Reply to this email directly or view it on GitHub: https://github.com/monsieurje/ICViewPager/issues/23

iltercengiz avatar Nov 13 '13 16:11 iltercengiz

Same here. Happens to me when I load the ViewPager into a subview that is under a fixed element like e custom tab bar.

andreacfm avatar Nov 21 '13 15:11 andreacfm

Can you please provide a screenshot or a little more info? I am not sure if I understood the situation properly.

iltercengiz avatar Nov 21 '13 17:11 iltercengiz

Loading the pager view into under a custom toolbar into subview:

    pageViewController = [[MWCheckInPagerViewController alloc] initWithNibName:@"MWCheckInPagerViewController" bundle:nil];
    pageViewController.view.frame = self.pagerView.bounds;
    [self.pagerView addSubview:pageViewController.view];

screenshot 2013-11-27 11 15 39

andreacfm avatar Nov 27 '13 10:11 andreacfm

What's the output of NSLog(NSStringFromCGRect(pageViewController.view.frame); and NSLog(NSStringFromCGRect(self.pagerView.bounds); ?

iltercengiz avatar Nov 27 '13 11:11 iltercengiz

{{0, 0}, {320, 460}}
{{0, 0}, {320, 460}}

andreacfm avatar Nov 27 '13 11:11 andreacfm

If I understood correctly, you are getting the root view of ViewPagerController's (in this case its subclass', MWCheckInPagerViewController) and setting it as a subview to another view. Am I right? If so I hadn't tested it in a usage way like this, I'll test it and look what can be done. It would be perfect if you can email me the codes of the view controllers in this screenshot.

iltercengiz avatar Nov 27 '13 12:11 iltercengiz

Yes you are correct.

Here is the xib used by the controller.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="4514" systemVersion="13A603" targetRuntime="iOS.CocoaTouch" variant="6xAndEarlier" propertyAccessControl="none">
    <dependencies>
        <deployment defaultVersion="1552" identifier="iOS"/>
        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3747"/>
    </dependencies>
    <objects>
        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="MWCheckinViewController">
            <connections>
                <outlet property="backToCheckInButton" destination="1vr-Nv-S3n" id="CNd-ae-yRp"/>
                <outlet property="backToTagButton" destination="PEp-1L-ulS" id="q7G-Wk-KM1"/>
                <outlet property="favouriteButton" destination="HnR-bB-gxI" id="rag-ke-IXK"/>
                <outlet property="pagerView" destination="neE-CY-mmE" id="b0K-4B-aTy"/>
                <outlet property="settingsButton" destination="dI6-ea-YT9" id="zdU-gf-WxT"/>
                <outlet property="view" destination="1" id="cgo-Qs-LZy"/>
            </connections>
        </placeholder>
        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
        <view contentMode="scaleToFill" id="1">
            <rect key="frame" x="0.0" y="20" width="320" height="460"/>
            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
            <subviews>
                <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="tabup.png" id="YDH-lm-Hmq">
                    <rect key="frame" x="0.0" y="0.0" width="320" height="50"/>
                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                </imageView>
                <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="linguetta_preferiti.png" id="YDi-gv-ntU">
                    <rect key="frame" x="273" y="0.0" width="34" height="41"/>
                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                </imageView>
                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="dI6-ea-YT9">
                    <rect key="frame" x="1" y="0.0" width="55" height="45"/>
                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                    <fontDescription key="fontDescription" type="system" pointSize="15"/>
                    <state key="normal" image="btn_opzioni.png">
                        <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
                    </state>
                    <connections>
                        <action selector="settingsButtonPressed" destination="-1" eventType="touchUpInside" id="fiF-q6-iB9"/>
                    </connections>
                </button>
                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="1vr-Nv-S3n">
                    <rect key="frame" x="83" y="0.0" width="65" height="45"/>
                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                    <state key="normal" image="btn_tagrecenti.png">
                        <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
                    </state>
                    <connections>
                        <action selector="backToCheckInButtonPressed" destination="-1" eventType="touchUpInside" id="yCd-1O-ipL"/>
                    </connections>
                </button>
                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenDisabled="NO" lineBreakMode="middleTruncation" id="PEp-1L-ulS">
                    <rect key="frame" x="173" y="0.0" width="65" height="45"/>
                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                    <state key="normal" image="btn_ritornatag.png">
                        <color key="titleColor" red="0.19309852612755288" green="0.31125460827721974" blue="0.52530570652173914" alpha="1" colorSpace="calibratedRGB"/>
                        <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
                    </state>
                    <connections>
                        <action selector="backToTagButtonPressed" destination="-1" eventType="touchUpInside" id="jhC-vj-rwO"/>
                    </connections>
                </button>
                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="HnR-bB-gxI">
                    <rect key="frame" x="260" y="0.0" width="60" height="45"/>
                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                    <state key="normal" image="btn_preferiti.png">
                        <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
                    </state>
                    <connections>
                        <action selector="favoriteButtonPressed" destination="-1" eventType="touchUpInside" id="bEg-tm-Kla"/>
                    </connections>
                </button>
                <view contentMode="scaleToFill" id="neE-CY-mmE">
                    <rect key="frame" x="0.0" y="50" width="320" height="460"/>
                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                </view>
            </subviews>
            <simulatedStatusBarMetrics key="simulatedStatusBarMetrics"/>
            <simulatedScreenMetrics key="simulatedDestinationMetrics"/>
        </view>
    </objects>
    <resources>
        <image name="btn_opzioni.png" width="26" height="26"/>
        <image name="btn_preferiti.png" width="26" height="26"/>
        <image name="btn_ritornatag.png" width="26" height="26"/>
        <image name="btn_tagrecenti.png" width="26" height="26"/>
        <image name="linguetta_preferiti.png" width="34" height="41"/>
        <image name="tabup.png" width="320" height="50"/>
    </resources>
</document>

And this the what happens in viewDidLoad:


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    pageViewController = [[MWCheckInPagerViewController alloc] initWithNibName:@"MWCheckInPagerViewController" bundle:nil];
    pageViewController.checkinViewController = self;
    pageViewController.view.frame = self.pagerView.bounds;

    NSLog(NSStringFromCGRect(pageViewController.view.frame));
    NSLog(NSStringFromCGRect(self.pagerView.bounds));

    self.pagerView.backgroundColor = [UIColor clearColor];
    pageViewController.view.backgroundColor = [UIColor clearColor];
    [self.pagerView addSubview:pageViewController.view];
}

andreacfm avatar Nov 27 '13 12:11 andreacfm

i have met the same problem, i want to ask you if you have solved the problem @iltercengiz @andreacfm

hackjie avatar Nov 10 '15 13:11 hackjie

I faced similar issue and I find a workaround in stackoverflow. inside viewPagerController.m in the method -(void) layoutSubviews comment out the code for IOS 7 support. // if (IOS_VERSION_7) { // topLayoutGuide = 20.0; // if (self.navigationController && !self.navigationController.navigationBarHidden) { // topLayoutGuide += self.navigationController.navigationBar.frame.size.height; // } // }

That solved my problem.

joyeshk avatar May 10 '16 12:05 joyeshk