Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
github.com/TimOliver/TONavigationBar
TONavigationBar
is an open-source subclass of UINavigationBar
that adds the ability to set the background content of the navigation bar to transparent, and then gradually bring it back in as the user scrolls through the page.
Apple uses this effect in their 'modern' style iOS apps (Music, TV, App Store) for any content deemed 'notable'. Unfortunately, while it seems like a trivial thing to be able to do, none of the APIs necessary to reconfigure a UINavigationBar
to be transparent in that way exist. TONavigationBar
internally re-implements a variety of the UINavigationBar
functionality in order to make this possible.
UINavigationController
.UINavigationController
's 'swipe-to-go-back' gesture.UINavigationBar
appearance.UIScrollView
may be specified in order to avoid having to manually pass information to the bar.TOHeaderImageView
, a header view that may be used as the banner in scroll views.iOS 11.0 or above
Add the following to your Podfile:
pod 'TONavigationBar'
All of the necessary source files are in the TONavigationBar
, folder. Simply copy that folder to your Xcode project and import all of the files in it.
TONavigationBar
has been designed to be as hands-off as possible. It integrates with UINavigationController
and only needs to be interacted with when changing the visibility of the background content.
UINavigationController
#import "TONavigationBar.h"
UINavigationController *navigationController = [[UINavigationController alloc] initWithNavigationBarClass:[TONavigationBar class] toolbarClass:nil];
#import "TONavigationBar.h"
@implementation MyViewController // A child of the `UINavigationController` stack
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self.navigationController.to_navigationBar setBackgroundHidden:YES animated:animated forViewController:self];
[self.navigationController.to_navigationBar setTargetScrollView:self.tableView minimumOffset:200.0f]; // 200.0f is the height of the header view
}
@end
#import "TOHeaderImageView.h"
@interface MyTableViewController () <UIScrollViewDelegate>
@property (nonatomic, strong) TOHeaderImageView *headerView;
@end
@implementation MyTableViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.headerView = [[TOHeaderImageView alloc] initWithImage:[UIImage imageNamed:@"MyPicture.jpg"] height:200.0f];
self.headerView.shadowHidden = NO;
self.tableView.tableHeaderView = self.headerView;
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
self.headerView.scrollOffset = scrollView.contentOffset.y;
}
@end
TONavigationBar
In order to modify UINavigationBar
to the same style Apple uses, a few things need to happen:
UIBarStyleBlack
(Which makes UINavigationController
change the status bar style to white.)Changing the tint color and bar style are trivial, however there are no public APIs provided by Apple to easily control the alpha of just the background views, or the title label.
The way TONavigationBar
solves this is as follows:
[UINavigationBar setBackgroundImage:[[UIImage alloc] init]
and then a wholly custom set are put in their place. This also means transitioning it back while scrolling is possible.UINavigationBar
's internal views, finding the right one, and then overriding its presentation by Apple's code.Yes. It should be. The only slightly dubious thing this view does is that it traverses some internal Apple views to find the title label. However no private APIs are called in the process, so that should be no problem.
That being said, internal view traversal is always a terrible way to go, and this library MAY break in future versions of iOS without maintenance. Thankfully, it's set up so if it does break, the absolute worst thing that can happen is that the title label will always be visible.
TONavigationBar
was originally created by Tim Oliver as a component for iComics, a comic reader app for iOS.
Firewatch Wallpaper by Campo Santo and is used for illustrative purposes. Firewatch is available on Steam.
iOS Device mockups used in the screenshot created by Pixeden.
TONavigationBar
is licensed under the MIT License, please see the LICENSE file.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.