UIButton height unintentionally increased - Widget - iOS 8 - ios

I am developing an iOS 8 app with a Notification center widget. One problem I am having is that when I first open the widget, the UIButtons (which are in one UIView) are stretched vertically (even though I did not specify this).
When the user closes notification center or swipes to the notifications tab and then goes back to widgets, the UI returns to its normal state and is perfect and works exactly how I want it to look and behave.
So to confirm, I am only having this issue when the user installs the app and adds the Widget to Notification center for the first time. Then as long as they don't get rid of the widget from the notification center, then its UI is normal. It is only when the user removes and adds the widget again when this issue then happens again (once only).
I am not using Auto Layout (yes I know its recommended, but I can't stand it) and my app is iOS 8 only.
More to the point, once the uses closes notification center or simply swipes to the notifications tab and then returns to the widgets section, my widget UI works perfectly with no issues what so ever.
I have tried to manually set the height of the view containing the UIButtons myself, but it doesn't seem to work. I used this code to do that:
CGRect newFrame = CGRectMake( xCoordinate, yCoordinate, width, height);
myView.frame = newFrame;
Has anyone else experienced this issue? And if so, any ideas on how I can go about fixing it????
Thanks, Dan.

Oh urmmm... ok I literally just fixed this issue by doing the following:
So I basically got rid of the vertical resizing property on the UIView which contains the UIButtons and its fixed....
I must admit, this is odd though because since I want the view to resize (to the size of the view but not longer), this is why I selected this property.
More to the point, for the main app, I had to select this property for the view to resize properly... hmmm.. I guess iOS Widget views resize differently or something.
Oh well, issue fixed :)

Related

Can part of an AppleWatch interface scroll independently?

I've got a WatchKit app that consists of a label and a couple of buttons. The label's contents might be long enough to cause scrolling, but I want the buttons to stay onscreen. Is it possible to have the label content scroll instead of the whole screen?
I've tried embedding the label in a WKInterfaceGroup, but the height of the label gets constrained to the height of the group.
I also tried to find a way to do this, but I couldn't find anything. Based on the simple flow layout for a Watch App UI I am pretty sure this can't be done.
(I am going to guess I was trying to do the same/similar UI as you ;)

iOS app only showing half in simulator

I am trying to develop a simple app with one screen for iOS and am running into a strange problem. Only half of the app is showing up. For example I have a screen with just one button in the center of the screen. When I run the app in the simulator I only see half the button and I cannot move it either.I can scroll the view in the simulator vertically but not horizontally. I am stumped. Will appreciate any pointers.
I'm pretty sure you built your view using the main storyboard and put everything in the middle of it. The main storyboard is set to take all iOS format into account, iPhone and iPad. If you want your app to appear centered on your iOS device, you need to constraint the position of your different UI objects, using Auto Layout. That way it would appear centered automatically, whatever is the device you're using
I reckon you've got AutoLayout turned on... but haven't set any constraints on your controls yet.
Try the following test:
Go into your Storyboard file.
Click on a blank area in your storyboard, then on your screen (so the border of your screen is blue - not black or gray).
In the menu bar, click on Editor \ Resolve Auto Layout Issues, and then "Update Frames".
Alternatively, you can click on the following button, and select "Update Frames" from there (it doesn't matter which one):
When you do this, where does your "one button" end up ? Does it suddenly disappear off the screen, have a negative X or Y position, or a width/height of 0 ? If so, then AutoLayout is your problem.
With XCode 6.1, Apple has put a gun to developers' heads and demanded that when you add an object to a Storyboard, you must - straightaway - add some constraints to it.
I had this issue when I first upgraded to XCode 6.
I would add, say, a View to a screen, stretch it to a particular size, then drag a second control (perhaps a Label) onto the same screen. Suddenly, my View would resize itself to a height/width of zero, or be positioned way off the side of the screen... huh ?!
To get around this, when you add a control onto a Storyboard, you must add sufficient constraints to really let XCode calculate where to position it, based on which device/orientation the device is running on. And, yes, you sometimes need to do this straightaway before XCode ridiculously decides to mess up your control's position or size.
I really do loathe XCode. This isn't the way a development environment should behave in 2015...
If I get your point of problem then
I m sure the problem is you have auto layout and size classes enabled.
check if you have Auto layout and size classes enabled ....???
If yes then you haven't set the constraints accurately. set the constraints for the UI Objects to show on your desired position in screen.

On orientation change touch events recognized for half the screen(portrait width)

I have a PageViewController which handles the gestures so I have not done anything with it. I disabled auto-layout in my storyboard so that I could use autoresize to fill the screen with views.
I have a tabbar and if I reload the page with the tabbaritem. The gesture are working.
How can I make the touch/gesture handler resize on orientation change?
http://kevindew.me/post/18579273258/where-to-progmatically-lay-out-views-in-ios-5-and
In the above link you will find usefull information about laying out and handling orientation changes. Also I had this problem once on a device with lower iOS version if your version can be updated you can try that however it's not a fix. I recommend to check the link and see if your views are properly layed out.

IOS - How to get my text view object information to scroll on view?

I am using Mac OS X Lion 10.7.5 and XCode Version 4.6.1 (4H512),
I have looked at these answers on stackoverflow to try to figure out my question
-cannot make a text view scroll - xcode 4.3
-also posts that looked possible, when I searched on "scroll text in UITextView" within stackoverflow
Within Interface Builder I cannot figure out how to make information in a UiTextView object scroll within the iPhone simulator*. To resolve this challenge, I have made the most simple prototype project I can think of, just a view and one text view object on it, filling the text view object with a stream of text simply typed in via interface builder. For this most basic sample I'm using to sort out my problem, I have not done anything programatic. (Please note that I am aware of StoryBoards and have begun working through a book to learn to use them, but I would like to finish my first prototype app using what I’ve already learned and fully complete one project before I move onto my next project using StoryBoards.)
When I run this in the iPhone simulator, I see the sample information in my text view object come up. As I expected not all the information displays, due to my sizing the box a little too small on purpose. But I cannot flick or arrow down, or in any other way view the rest of the text information within the simulator. Nor do I see scrolling bars anywhere on the view. The information is just frozen in/on the view.
Inspector Settings
Identity Inspector
"Accessibility" Tested both with Enabled checked and not checked
Use Auto Layout is NOT checked
Attributes Inspector
Behavior Editable box not checked
Scroll View Area Checked ‘show horizontal scrollers, shows vertical scrollers and also scrolling enabled” The rest of the scrollers box are not checked
Bounces is checked
Zoom min and max are both 1
Touch all boxes checked- bounces zoom, delays content touches, cancellable content touches
View mode is ‘scale to fill”
Interaction ‘multiple touch’ is checked
Drawing checked opaque, clears graphics context, clip subviews, and autoresize subviews. Only ‘hidden’ is not checked
Size Inspector
I played around with the ‘scrolling insets’ boxes changing them from the default (I think it was 0 or 1), just to see if I noticed anything. I think maybe that I see some shadowy marker type lines in Interface builder in the area where I might expect a scroll bar when I make these changes, but no change in appearance within the simulator.
I cannot figure out why my actual iPhone device with everything up to date, is now not working as a test device, but I believe that is a separate challenge
how about wrapping you uitextfield in a uiscrollview. Make the scroll view the dimensions you currently are setting the uitextfield to, then allow your uitextfield to scale to the size of the text.
This is one of those questions that solved itself eventually. After twice creating the most basic app, with no programmatic bits just interface builder and a textView object with all the defaults the scrolling worked. The only reason I can think of that it might not have scrolled as expected the first time through may have had to do with placement of the textView object on the view. I wonder if it overlapped the bottom of the view and maybe that messes something up.
Just one of those situations where I had to keep plugging away, trying what seemed like the same thing repeatedly,set in the Inspectors, and suddenly, like magic, it worked. Except no magic involved.

iOS drawing and animations... how do they work?

I am rather new to iPhone development just stating that out there.
I am developing for iOS 5+
I am currently using storyboard
Here's how my storyboard looks currently:
On ViewLoad I lower the buttons using [TheButtonView center] = curpos+(0,-cords);
and when the view shows I then raise them back up to their original position after a few seconds using basic animations.
The problem is that with autolayout it seems to constrain the animations scope. When I rotate the device the logo no longer retains its animated offset and reverts back to its original auto-layout position.
How would I retain the offset do I just use [TheButtonView center] = curpos+offset when rotated?
Sorry for the general questions.
Edit: Also is there a way to design a uielement that slides in on click but not take up space in the editor?

Resources