How to change home screen for Jailbreak Device programming - ios

I'm a newbie in iOSOpenDev. I want to change the home screen on my jailbroken device. I use iOSOpenDev with Logos tweak to implement this
%hook SBUIController
- (void)finishLaunching
{
SBUIController *uicontroller = (SBUIController *)[%c(SBUIController) sharedInstance];
// Get _contentView & _iconsView from SBUIController
UIView* _contentView = [uicontroller valueForKey:#"_contentView"];
UIView* _iconsView = [uicontroller valueForKey:#"_iconsView"];
// Hidden _iconsView
_iconsView.hidden = YES;
// Add Sphere View
SphereViewManager *sphere = [[SphereViewManager alloc] initWithFrame:[UIScreen mainScreen].bounds];
sphere.frame = [UIScreen mainScreen].bounds;
sphere.tag = 20141201;
[_contentView addSubview:sphere];
}
After SpringBoard is restarted, my home screen is loaded. But when I tap an app to launch, and then I press the HOME button, my device returns to the old home screen. How do I prevent my HOME screen from returning the the old view?

Related

NSStatusItem doesn't work in fullscreen mode starting 10.13

Very simple application. When any other application is in fullscreen mode my apps system tray drop down menu doesn't show up. Other application like system time's drop down shows up properly.
No app in fullscreen
Xcode app in full screen (icon is clicked but drop down is not shown)
Here is my code ->
NSStatusItem *g;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// Insert code here to initialize your application
NSStatusItem *statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength];
statusItem.menu = [[NSMenu alloc] init];
NSMenuItem *test = [[NSMenuItem alloc] init];
test.title = #"Just a test";
[statusItem.menu addItem:test];
NSImage *img = [NSImage imageNamed:#"icon.icns"];
[img setSize:NSMakeSize(18.0, 18.0)];
statusItem.image = img;
g = statusItem;
}

Cordova/PhoneGap iOS: WebView becoming shorter after taking a picture or opening InAppBrowser

When I take a picture with Camera plugin, the whole WebView becomes shorter. It's like the screen is being eaten from bottom for the height of the status bar - 20px. It doesn't have to do with taking a picture at all, it also happens if I only open gallery and then close it. The same thing happens if I open InAppBrowser and then close it. Here is an example:
This is how it looks before choosing a photo
Then the photo choosing dialog appears (doesn't matter if it's emulator, it behaves the same on the real device)
And then this happens when I close the dialog - look at the bottom of the screen
And if I continue to add photos, each time the screen gets 'eaten' by 20px
I found out that the window.innerHeight is getting reduced by 20px, so it has something to do with the status bar. How can I fix this?
I stumbled upon the answer in another thread. Here it is:
In MainViewController.h:
#interface MainViewController : CDVViewController
#property (atomic) BOOL viewSizeChanged;
#end
In MainViewController.m:
#implementation MainViewController
#synthesize viewSizeChanged;
[...]
- (id)init
{
self = [super init];
if (self) {
// On init, size has not yet been changed
self.viewSizeChanged = NO;
// Uncomment to override the CDVCommandDelegateImpl used
// _commandDelegate = [[MainCommandDelegate alloc] initWithViewController:self];
// Uncomment to override the CDVCommandQueue used
// _commandQueue = [[MainCommandQueue alloc] initWithViewController:self];
}
return self;
}
[...]
- (void)viewWillAppear:(BOOL)animated
{
// View defaults to full size. If you want to customize the view's size, or its subviews (e.g. webView),
// you can do so here.
// Lower screen 20px on ios 7 if not already done
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7 && !self.viewSizeChanged) {
CGRect viewBounds = [self.webView bounds];
viewBounds.origin.y = 20;
viewBounds.size.height = viewBounds.size.height - 20;
self.webView.frame = viewBounds;
self.viewSizeChanged = YES;
}
[super viewWillAppear:animated];
}
Source: https://stackoverflow.com/a/19407903/1555838

iOS esri sdk - Multiple Popups using AGSPopupsContainerViewController

I am using AGSPopupsContainerViewController to display multiple popups when touching on mapView we fetch more than one AGSGraphics.
Here is my code:
NSMutableArray *popups =[[NSMutableArray alloc]init];
AGSPopupInfo *popupinfo;
for (AGSGraphic *g in Graphics ) {
popupinfo =[AGSPopupInfo popupInfoForGraphic:g] ;
AGSPopup* popup = [AGSPopup popupWithGraphic:g popupInfo:popupinfo];
popup.allowEditGeometry = false;
[popups addObject:popup];
}
if (!popupVC) {
self.popupVC = [[AGSPopupsContainerViewController alloc] initWithPopups:popups
usingNavigationControllerStack:false];
}else{
[self.popupVC showAdditionalPopups:popups];
}
self.popupVC.delegate = self;
self.popupVC.doneButton = self.customActionButton;
self.popupVC.style = AGSPopupsContainerStyleCustomColor;
self.popupVC.barItemTintColor = [UIColor redColor];
self.popupVC.pagingStyle = AGSPopupsContainerPagingStyleToolbar;
// Animate by flipping horizontally
self.popupVC.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
// If iPad, use a modal presentation style
if([[AGSDevice currentDevice] isIPad])
self.popupVC.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentViewController:self.popupVC animated:YES completion:nil];
All works fine, I have the right number of pupups, the problem is that using the arrows in the toolbar I can only see the first and the last ones. Why? I am missing something?
Arrows are doing what they are supposed to do - using them will show you the first and the last popup. Swipe to the left (or right) and you'll see the rest of the popups.

On dismiss view iAds becomes black in ios 5 ipad.(dark black)

I have a tab based application. I have created an iAd object in app delegate class and using it in my three view controller class. It's working good on second tab's screen and third tab's screen. On second tab there is a table view, when clicking the row of that table view i navigate to the new view where i have used the same code for iAd. On clicking the iAd, iAd screen opens in landscape mode and when closing the screen becomes black and log the following.
[ADHostWindowController supportsOrientation:]: message sent to deallocated instance 0x100bc740
I created the object in app delegate like this:
self.bannerView = [[ADBannerView alloc]init];
[self.bannerView setDelegate:self];
I'm adding banner in view controllers like this:
[[[self appdelegate] bannerView] setFrame:CGRectMake(0, hightofView-180, 768, 66)]
All my view controllers are in portrait but iAds always open in landscape mode.
This is working in iOs 6, but not with iOS 5 on iPad. How do I fix this?
My guess your problem is not related to iAds but rather to memory issues.
It seems that an object of class kind ADHostWindowController is being deallocated prematurely.
My advice would be to make sure that ADHostWindowController is not released i.e (retainCount>=1) before supportsOrientation: is called to it. (which is definitely after the iAd opens).
For diagnosis: Try logging the retain count of that ADHostWindowController (then maybe retaining it one more time) before opening an iAd and see what happens.
Take a look at TabbleBanner code in iAd sample from Apple: https://developer.apple.com/library/ios/#samplecode/iAdSuite/Introduction/Intro.html
I don't investigate it in detail, but you need to follow the Apple iAd guide:https://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/iAd_Guide/BannerAdvertisements/BannerAdvertisements.html
To create a ADBanner, in each UIViewController, add one to self.view
#property (strong,nonatomic) ADBannerView *bannerView;
- (void)viewDidLoad
{
[super viewDidLoad];
[self createADBanner];
}
- (void)createADBanner{
self.bannerView = [[ADBannerView alloc] initWithFrame:CGRectZero];
self.bannerView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;
[self.bannerView setDelegate:self];
[self.view addSubview:self.bannerView];
}
For beginning, you need to modify bannerView size and setCenter if need to place it at top or bottom.
- (void)viewDidLayoutSubviewsj{
if (UIInterfaceOrientationIsLandscape(self.interfaceOrientation)) {
self.bannerView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierLandscape;
self.bannerView.center = CGPointMake(self.view.center.x, self.view.frame.size.height - self.bannerView.frame.size.height/2);
} else {
self.bannerView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;
self.bannerView.center = CGPointMake(self.view.center.x, self.view.frame.size.height - self.bannerView.frame.size.height/2);
}
}
And do the same when rotate:
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
if (UIInterfaceOrientationIsLandscape(toInterfaceOrientation)) {
self.bannerView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierLandscape;
self.bannerView.center = CGPointMake(self.view.center.x, self.view.frame.size.height - self.bannerView.frame.size.height/2);
} else {
self.bannerView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;
self.bannerView.center = CGPointMake(self.view.center.x, self.view.frame.size.height - self.bannerView.frame.size.height/2);
}
}

Open Game Center UI with Cocos2d-x

I have set up so that my app can connect to the Game Center. I followed this guide and had a C++ class wrapper to call them in my other classes. I'm using iPad (iOS 5.1), iPod Touch 4th Gen (iOS 5.1), and iPhone 4s and 3GS to test. It works fine on iPad devices but for some unknown reason, it does not on iPhone and iPod. It properly connects to the Sandbox but the UI is not shown, or rather, the UI is somewhere off-screen.
What happens on the iPhone is:
If I'm not logged in and I access the Game Center, a login window appears. When I log in, nothing happens. However, the console says a view is added.
If I'm logged in and I access the Game Center, nothing happens. However, the console says a view is added.
If I access the Game Center before I get authenticated, the Game Center UI appears. However...
The Game Center is in Landscape Mode (no problem there, since my app is in landscape) but the top bar (the bar with the DONE button) is placed as if the orientation is portrait.
The whole UI is not shown, just ~30% of the screen.
This is how I launch the Game Center UI:
- (void)showLeaderboardForCategory:(NSString *)category
{
// Only execute if OS supports Game Center & player is logged in
if ( hasGameCenter )
{
// Create leaderboard view w/ default Game Center style
GKLeaderboardViewController *leaderboardController = [[GKLeaderboardViewController alloc] init];
// If view controller was successfully created...
if (leaderboardController != nil)
{
// Leaderboard config
leaderboardController.leaderboardDelegate = self; // The leaderboard view controller will send messages to this object
leaderboardController.category = category; // Set category here
leaderboardController.timeScope = GKLeaderboardTimeScopeToday; // GKLeaderboardTimeScopeToday, GKLeaderboardTimeScopeWeek, GKLeaderboardTimeScopeAllTime
// Create an additional UIViewController to attach the GKLeaderboardViewController to
myViewController = [[UIViewController alloc] initWithNibName:nil bundle:nil ];
// Add the temporary UIViewController to the main OpenGL view
// NOTE: This is the part that I think is the suspect. I am not sure if iPhones and iPods support EAGLView.
[ [ EAGLView sharedEGLView ] addSubview:myViewController.view ];
// Tell UIViewController to present the leaderboard
[ myViewController presentModalViewController:leaderboardController animated:NO ];
NSLog( #"Leaderboard opened." );
}
}
}
Any help is appreciated and thanks in advance.
EDIT: Using OpenFeint is not an option.
Try this.Do not use 'EAGLView'
- (void) showLeaderboard
{
if (!gameCenterAvailable) return;
GKLeaderboardViewController *leaderboardController = [[GKLeaderboardViewController alloc] init];
if (leaderboardController != nil) {
leaderboardController.leaderboardDelegate = self;
UIWindow *window = [[UIApplication sharedApplication] keyWindow];
currentModalViewController = [[UIViewController alloc] init];
[window addSubview:currentModalViewController.view];
[currentModalViewController presentModalViewController:leaderboardController animated:YES];
}
}

Resources