Status Bar issue - iphone

As you can see from my image, the status bar is displaying on top of my table view and i don't understand what i have done wrong for this to happen. i am sure that it will be a simple fix and i'm just missing it.
Any help will be much appreciated, Thanks!

you can avoid this problem by writing below code in ViewDidLoad method...
float SystemVersion=[[[UIDevice currentDevice] systemVersion] floatValue];
if(SystemVersion<7.0f)
{
//Currently your app is running in IOS6 or older version. So you need not to do anything.
}
else
{
// Currently your app is running in IOS7. Do the following.
CGRect TempRect;
for(UIView *sub in [[self view] subviews])
{
TempRect=[sub frame];
TempRect.origin.y+=20.0f; //Height of status bar
[sub setFrame:TempRect];
}
}
let me know it is working or not my friend!!!
Happy Coding!!!!

like this.. In Autosizing of Custom bar...Only connect to upper side....
Let me know it is working or not!!!
Happy Coding!!

Related

How can I stop views on screen from multiplying? (touchesBegan,touchesMoved,touchesEnded)

I am new to Objective C and I am trying to make a basic puzzle game. I am using multiple UIImage objects, some labels and a button. It consists in moving the pieces to its correct position. If the user fails to put a piece in a place, the piece goes back to its original location.
That part works perfectly, the problem begins once I 'remove' that view and continue on the other screens. Whenever I click ANYWHERE on screen the views get multiplied endlessly. Why is that happening?
What should I do?, I am so desperate, I've tried almost everything including ignoring touches, blocking touches, etc. And this only creates more trouble.
I have already tried setting using interactions to no, ignoring interaction events, autoreleasing the view, and I have not reached a solution.
Any help will be very much appreciated. Greetings!
---> I tried posting an image but given that I am a newbie I wasn't able to, however I can send the image to anyone if needed to show you the weird effect I get.
-(void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
[self touchesCancelled:touches withEvent:event];
}
-(IBAction) navigationConversation: (id)sender{
//[self.view.superview setUserInteractionEnabled:NO];
//[[UIApplication sharedApplication] endIgnoringInteractionEvents];
if (nextButton.hidden == NO) {
conversation *navigationConversationController=[[conversation alloc] initWithNibName:#"conversation" bundle:nil];
[self.view addSubview:navigationConversationController.view];
if (self.view.superview == nil)
[navigationConversationController autorelease];
}
return;
}
Thank God, the problem is solved now. This are the changes I made, and this corrected the mistake. :)
-(IBAction) navigationConversation: (id)sender{
if (nextButton.hidden == NO) {
//I disabled the interactions with the puzzle view in here, thus eliminating the problem
[self.view.superview setUserInteractionEnabled:NO];
conversation *navigationConversationController=[[conversation alloc] initWithNibName:#"conversation" bundle:nil];
[self.view addSubview:navigationConversationController.view];
if (self.view.superview == nil)
[navigationConversationController autorelease];
}
return;
}
Thanks to everyone who looked! and wanted to help! I hope this works for other people having the same issues.

How to set ICarousel to slide one time for one one image

I am using ICarousel to make my Electronic Album. When you slide the album , the default setting by ICarousel is that it will move to some distance. What I need is slide one time for one one image only. I found ICarousel is not based on ScrollView , So I can not figure out how to achieve my purpose, is someone who know about it?
Updated answer with the more recent versions of iCarousel :
iCarousel now supports single-page swiping by setting
pagingEnabled=YES.
I would recommend turning off the native scrolling and attaching a PanGestureRecognizer that utilizes the scrollByNumberofItems method.
[iCarousel setScrollEnabled:NO];
Then inside your gestureRecognizer:
[iCarousel scrollByNumberOfItems:1 duration:0.25];
I tried this myself and it worked great.
It seems that you have to use another library called SwipeView, implemented by the same author.
The issue was found here.
https://github.com/nicklockwood/iCarousel/issues/247
I achieved that for type iCarouselTypeCoverFlow by setting:
//In ViewController.m
self.carousel.pagingEnabled = YES;
//In iCarousel.m change for smooth animation
-(void)scrollByOffset:(CGFloat)offset duration:(NSTimeInterbal)duration{
if (duration > 0.0)
{
_decelerating = NO;
_scrolling = YES;
_startTime = CACurrentMediaTime();
_startOffset = _scrollOffset;
// _scrollDuration = duration;
// set constant duration instead
_scrollDuration = 1.0;
_endOffset = _startOffset + offset;
if (!_wrapEnabled)
{
_endOffset = [self clampedOffset:_endOffset];
}
[_delegate carouselWillBeginScrollingAnimation:self];
[self startAnimation];
}
else
{
self.scrollOffset += offset;
}
}
Modify iCarousel source code iCarousel.m file may do this!
- (void)didPan:(UIPanGestureRecognizer *)panGesture {
......
case UIGestureRecognizerStateChanged: {
CGFloat translation = _vertical? [panGesture translationInView:self].y: [panGesture translationInView:self].x;
translation = translation * 0.35; // Add This line to change the really translation.
......
}
}
That solve my problem,Hope to help you!

issue about willAnimateRotate and didRotateFrom when doing an rotation

What I am having so far is
-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
NSLog(#"willAnimateRotationToInterfaceOrientation");
if(toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {
NSLog(#"PortraitUpsideDown");
// Do method A
} else {
[[self.view subviews] makeObjectsPerformSelector:#selector(removeFromSuperview)];
// Do method B
}
}
and
-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
NSLog(#"didRotateFromInterfaceOrientation");
if( fromInterfaceOrientation == UIInterfaceOrientationPortrait || fromInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown){
NSLog(#"OrientationPortrait or PortraitUpsideDown");
[[self.view subviews] makeObjectsPerformSelector:#selector(removeFromSuperview)];
// Do method B
} else {
NSLog(#"From else");
[[self.view subviews] makeObjectsPerformSelector:#selector(removeFromSuperview)];
// Do method A
}
}
My logic is after hitting the RUN from xcode, willAnimateRotationToInterfaceOrientation: is going to be called because I set Supported Device Orientation to be UpsideDown from Summary of MyApp.xcodeproj. Moreover, I also think that didRotateFromInterfaceOrientation: should not be called because we have just started the app yet. It means there are no previous states at all.
Unfortunately, this is what I got after doing the debugger
2012-02-11 12:04:08.776 MyApp[7505:10703] willAnimateRotationToInterfaceOrientation :
2012-02-11 12:04:08.776 MyApp[7505:10703] PortraitUpsideDown
2012-02-11 12:04:08.778 MyApp[7505:10703] didRotateFromInterfaceOrientation :
2012-02-11 12:04:08.779 MyApp[7505:10703] OrientationPortrait or
PortraitUpsideDown
I am getting lost now. Does anyone have any ideas about the issue, please help. Thanks.
I have had some issues with rotation, similar to yours. The short version is that the will and did methods are not 100% reliable. You should try rapidly rotating back and forth and see what happens. It could be because I am pretty new, or it could be an actual bug. What I did was, in didRotateFromInterfaceOrientation:, check the current orientation and act accordingly:
if (UIInterfaceOrientationIsPortrait(self.interfaceOrientation) {
// do your portrait stuff
} else {
// do your landscape stuff
}
Before I found the UIInterfaceOrientationIsPortait test I was actually checking the frame to see if self.view.frame.size.width > self.view.frame.size.height, and that is also reliable but kind of ugly.
Either way is reliable. I have a couple apps in the store, QPalettes and QColor, that do rotation on a bunch of user-created onscreen elements. What I had to do is store the dimensions, and after didRotateFromInterfaceOrientation I check the new dimensions and if they are different, re-draw everything onscreen. Contact me if you'd like a promo code to check out the rotation in either app (they rotate the same - QColor is more complex since it also draws intersections).
Enjoy,
Damien

FBlogin dialog box orientation problem

I'm facing a very silly problem and its really hard to resolve for me.
The fblogindialog box that i'm using in my application, appearing in portrait mode always.. But my whole application is in landscape mode.. the main thing is that the keyboard appears landscape and the web view in wich the login appears has the orientation which just suits the landscape mode (means the username and pwd txt boxes are that much wide so that if we rotate the device it would just fit into the landscape mode).
I tried every thing i looked for the status bar orientaition as well. its really frustrating. i'm using a button named post and on the click of this button i written the following code:
AppDelegate_iPhone *appDelegate =(AppDelegate_iPhone *)[[UIApplication sharedApplication]delegate];
if (appDelegate._session == nil)
{
appDelegate._session = [FBSession sessionForApplication:_APP_KEY secret:_SECRET_KEY delegate:self];
}
if(self.loginDialog == NULL || ![appDelegate._session resume])
{
self.loginDialog = [[[FBLoginDialog alloc] init] autorelease];
loginDialog.delegate = self;
[self.loginDialog show];
//self.loginDialog.frame = CGRectMake(0, 0, 480, 320);
[self.view addSubview:loginDialog];
}
here is the screen shot link-- http://i.stack.imgur.com/X4UHi.png
Please help me guys..
Thks very much .
finally i used new facebook sdk to solve this problem. and used the graph apis . A sample which explain all of this is --
https://github.com/reallylongaddress/iPhone-Facebook-Graph-API
and very helpful indeed.
Thanks

Custom iPhone KeyBoard for SDK 4 (iOS4 OS)

Old SDK solution:
- (void)modifyKeyboard:(NSNotification *)notification
{
UIView *firstResponder = [[[UIApplication sharedApplication] keyWindow] performSelector:#selector(firstResponder)];
for (UIWindow *keyboardWindow in [[UIApplication sharedApplication] windows])
for (UIView *keyboard in [keyboardWindow subviews])
if([[keyboard description] hasPrefix:#"<UIKeyboard"] == YES)
{
MyFancyKeyboardView *customKeyboard = [[MyFancyKeyboardView alloc] initWithFrame: CGRectMake(0, 0, keyboard.frame.size.width, keyboard.frame.size.height);
[keyboard addSubview: customKeyboard];
[customKeyboard release];
}
}
Following the above method, I now find that the iOS4 is different. It will not work. I am sure this is due to differences in naming subviews (or the sort). Does anyone know how to get around this same problem, for the iphone SDK 4?
You can have a look at this post:
http://www.neoos.ch/news/46-development/54-uikeyboardtypenumberpad-and-the-missing-return-key
It resolves the issue and works for all version of the SDK
Yes. iOS 4 supports custom input views—you can swap your own MyFancyKeyboardView in for any UIResponder-inheriting class (e.g. UITextField and UITextView)'s keyboard by setting the responder's inputView property.
The 4.1 SDK now has a UIKeyboardTypeDecimalPad which is what you're trying to do, right?
for ios 5, it seems that doesn't work. but when I change the code like this :
change UIKeyboard to UIPeripheralHostView
it works. I hope it's useful for some other developer.