keyboard movement when we click on textfield in obj c - objective-c

hii every one,
In my iphone app i need to scroll the page on click of textfield,actually it was working fine with xcode 3 ,on ios device 3.1.3,when i was using "UIKeyboardBoundsUserInfoKey"
but when i upgraded my xcode 3 to 4,it gave a warning saying that UIKeyboardBoundsUserInfoKey is deprecated u cant use ,so i replaced that API by UIKeyboardFrameBeginUserInfoKey now warning is gone but its not working on ios device 3.1.3,when i click on textfield it ill try to scroll the page but it ill crash,,how can i fix this,,can any one help me,...... thanx in advance

try this:
if (&UIKeyboardFrameBeginUserInfoKey!=nil) {
// use UIKeyboardFrameBeginUserInfoKey
} else {
// use UIKeyboardBoundsUserInfoKey
}

Related

Why are images in react-native app not rendering after Xcode 12 update

Not sure what to even document here. I update Xcode to 12.0.1, and out of nowhere, after building and running my application, the images inside the app are not rendering, not counting the splash screen, containing an image, which are built out natively.
These images, whether they're coming from firebase storage (remotely) or whether they're icons (locally) are simply not rendering. no changes in any image code or anything, anywhere in the application. the only change was the Xcode 12 update. and also a macOS update to Catalina 10.15.7
Any ideas on whats going on? let me know If I can provide additional details.
This behavior is a known issue with iOS 14 as you can see here.
You need to change the following file:
react-native/Libraries/Image/RCTUIImageViewAnimated.m
and add the following line:
- (void)displayLayer:(CALayer *)layer
{
if (_currentFrame) {
layer.contentsScale = self.animatedImageScale;
layer.contents = (__bridge id)_currentFrame.CGImage;
} else {
[super displayLayer:layer]; // add else statement with this line here
}
}
Source: https://github.com/facebook/react-native/issues/29279#issuecomment-658244428

iOS Navigation Bar Prefers Large Titles Scroll Behaviour

In iOS 11 the system apps all compress the navigation bar as you scroll down if you enable prefersLargeTitles:
I can't figure out how to implement this in my own apps though, the bar stays the same by default:
The only thing I can see is Hide Bars On Swipe, but that hides the whole bar rather than compressing it:
This is just an empty project created in Xcode 9 beta and with a new storyboard added.
What do I need to do to get the same behaviour as the system apps?
Don't set anything regarding Large Titles in Interface Builder / Storyboard, only in code. That worked for me.
So in the navigation bar in storyboards, Prefers Large Titles unchecked.
In your view controller:
self.navigationController?.navigationBar.prefersLargeTitles = true
It seems like this issue is happening to people for different reasons. None of the above answers helped me, but here's what DID work...
I deconstructed my app to find the cause, which was the view hierarchy in the storyboard. It appears that the UITableView view HAS to the the first view in your view controller. I had a UITableView with two UIImageViews behind it and that's what was causing the issue. Once I removed those UIImageViews everything worked correctly.
My fix: I ended up creating a UIView in code, adding my two image views to that, THEN adding that UIView to the UITableview.backgroundView.
Hope this helps someone.
If you have to target older iOS versions, you’ll also have to wrap the assignment in an availability check:
if #available(iOS 11, *) {
self.navigationController?.navigationBar.prefersLargeTitles = true
}
if #available(iOS 11.0, *) {
navigationController?.navigationBar.prefersLargeTitles = true
navigationController?.navigationBar.topItem?.title = "Hello"
navigationController?.navigationItem.largeTitleDisplayMode = .automatic
let attributes = [
NSAttributedStringKey.foregroundColor : UIColor.red,
]
navigationController?.navigationBar.largeTitleTextAttributes = attributes
} else {
// Fallback on earlier versions
}
http://iosrevisited.blogspot.in/2017/09/navigation-bar-with-large-titles-and.html

Cannot call method onCreateOptionsMenu () on startup for napp drawer

I have a problem only with nap drawer module.I have this code:
**drawer = NapDrawerModule.createDrawer({
//parameter for the drawer
});**
Then I have:
*
*drawer.getActivity().onCreateOptionsMenu = function(e) {
//code for creation menu**
}
Problem is that when I started application the method onCreateOptionsMenu() not called so my menu item not show up.When I pressed physical menu button it show up.
I noticed that this is problem only with NapDrawer.I tried make simple TI.UI.createWindow(),add method onCreateOptionsMenu() and it work.
I don't know what is a problem with drawer.I use titanium 5.0 and target android SDK 22.
I found the solution for the problem above.Anyone who has this kind of problem the next solution work for me.You need to add in your nap drawer create method next attribute:hamburgerIcon:true

Changing views on button click in Sencha Touch

I came across a situation in sencha touch where i need to change from one view to another on click of a button .
My view 1 is a dashboard which displays around 8 icons and on click of each icon different views are shown . So, i placed an home button in the header of those 8 different views and i am trying to get back to the dashboard which is not hapenning .Instead it is showing a blank screen and there was no error displayed in the console for me to check .
My code for changing the view on button click was :
{
xtype:'button',
cls:'clsHome',
text:'Home',
style: 'background:#4A4245;color:white;',
handler: function() {
console.log("Home Clicked");
var dashboardPanel = Ext.create('AppSupport.view.DashBoard');
Ext.Viewport.add(dashboardPanel);
//Ext.Viewport.setActiveItem(dashboardPanel,{type: 'slide', direction: 'left'});
}
}
Help me Guys ... Thanks in Advance ...!!!
You should try the Using Navigation View tutorial in sencha architect documentation... It gives a simple step by step guide for view navigation for an app. The navigation view also provides in built history support from sencha touch 2 onwards which also makes going back simple and easy
http://docs.sencha.com/architect/2/#!/guide/navigationview

How can I interact with "iPad keyboard hiding button" programmatically?

There is a button at bottom right of iPad keyboard which is to hide the keypad.
How can I interact with it programmatically? (get the button then send UIControlEventTouchUpInside to it).
Does anyone know this?
[Edit]
In my case, the keyboard is shown on a modal view.
Overriding disablesAutomaticKeyboardDismissal to return NO as below allows you to dismiss the keyboard when you resignFirstResponder, even when your UITextView is on a modal view. You should put this code to your view controller, from which you initiate the keyboard:
- (BOOL)disablesAutomaticKeyboardDismissal {
return NO;
}
Source: https://stackoverflow.com/a/6268520
In general, you would send the resignFirsResponder message to the active input view.
Something like this? I can't remember where I found this code but I used it to toggle the on-screen keyboard because it would be hidden by default if a bluetooth one was connected.
- (void) toggleKeyboard(UIKeyboardImpl * keyImpl){
if (UIKeyboardAutomaticIsOnScreen()) {
UIKeyboardOrderOutAutomatic();
} else {
UIKeyboardOrderInAutomatic();
}
Edit
I found where I got this code from. It works fine but the catch is that you need to import the private framework GraphicsServices, which would most likely get your app rejected from the App store.