How to make the UIView function like UIScrollView (Objective-C) - objective-c

I have a class named Topic. And inside that topic I can create (and delete) Messages. I need to show the messages in a view that can be scrolled/swiped either right or left (Right to show the older messages, and left to go back to the newer messages). Imagine an image collection that can be scrolled sideways in a ScrollView, that how this should look like. Since the messages is being add by the user, I can't use UIImage. I am thinking of the approach that I need to add use UIView instead of a ScrollView, now my problem is how can I make my UIView function as a ScrollView in terms of displaying data?
please help. Thanks.

You should have to use gesture recognition. Check that user is swiping left or swiping right. after Identifying that you can change UIView with animation. I hope you can get me. This can be useful to you.

You should be able to achieve what you want by enabling paging on the scroll view, by setting the following property to YES as shown:
scrollView.pagingEnabled = YES;
This will make the scroll view scroll one page at a time.

Related

Can't seem to achieve the same effect on my slide menu as Any.Do

I am trying to create the same type of slide-up/pull-up menu (from the bottom) as the Any.do iPhone app, but not having any success.
The issue I am running into is the app was built with storyboards so I am thinking I might have to scratch that idea and use just code.
Any ideas?
There is no need to get rid of your storyboard to recreate this, that's what IBOutlets are for. Any way, it looks like this was made by creating a UIScrollView that takes up the entire screen. Then add a UITableView to the upper section of the scroll view. Mind you in order for this to work, you'll need to disable scrolling on the scroll view in the background.
From there you can programmatically add the other elements to the scroll view to be rendered off screen, since there are only three they can probably just be buttons. And finally, since scrolling is disabled on the background scroll view you can add an image with a UISwipeGestureRecognizer at the bottom of the screen to manually change the scroll view's content offset property.

How can I avoid my UITextView from being covered by my UITableView?

I have created a forum with a View, and in the View I have placed a Text Field. My problem is, whenever I slide up they keyboard the text from the tableView are placed over the UIView and the TextField being covered. Any Idea what the reason behind this might be? While we are at it, maybe I shouldnt create a View with a TextField and instead use the standard look in iPhone sms apps, but I dont know how they created that bar. Any Ideas? I post all pictures below:
iPhone standard look, how to create something like this?:
My View with the text field:
My problem as i described above:
You can create a custom view for that and add it as an inputAccessoryView of the keyboard.
For more details please check apple documentation on this. When the keyboard is dismissed, show this view at bottom of the screen and when keyboard appears remove it from bottom and make it as inputAccessoryView.
inputAccessoryView:
The custom accessory view to display when the text view becomes the
first responder

IOS: How to make a tab bar on the left on iPad

I've seen many apps creating a side bar on the left like the image above. Apparently this is not a split view controller since the size is fix for that.
Anyone know how to do it? May I get some directions or advice on this?
It is shown in this tutorial, how you can implement that kind of "custom side Tab Bar", he did a video about it too.
That can be done simply by adding to your main view a UIView with a "vertical" frame, e.g. (0, 0, 44, screenHeight). That view should be then populated with all the icons you need...
There is nothing more to it, as far as I can see.
You can't use the default UITabBarController from iOS. You will need to do your custom tab bar. You could use an UIView with some UIButtons added as subviews.

iOS: People picker inside UIPopoverController, search keyboard distorts popover

I have a people picker inside a UIPopoverController, since it has a search field, which will trigger the keyboard when tapped, then I got this ugly result:
the arrow of the popover is UP which is best look in my app, I also tried to use UP | DOWN but it does not work(still always UP), I know I can use only DOWN arrow instead, but that should be the last solution, I wonder is there any method to deal with this?
Thanks!
update:
I was thinking that can I use UP arrow first, then when the search field becomes first responds(not sure how to detect this), I change it to DOWN arrow(also not sure how to do this)?
update 2:
also the view is not a table or something that can be scrolled, so I cannot scroll the view to make the popover look fine.
You are right, that is quite an ugly resolution.
The problem is that the UIPopoverController is coded to avoid colling with the keyboard view.
I think the only way you can work around this is to either create a custom UIPopoverController that ignores the keyboard appearing (i believe some listeners needs to be disabled on either the SharedApplication or mainscreen) or make a custom UIView that holds this.

Cocoa User-Resizable Views

how can i achieve user-resizable views like in interface builder, so that the user can adjust some images by their own
Do i have to manage all this manually with a view that watches mouse movement and so on?
You have to do all the work yourself. You will need to keep track of the objects in your view, their positions and do all the mouse tracking and view updating.
However, this is not actually very difficult, and Apple has provided a very complete example in its Sketch sample code.
I suggest drawing some buttons where you want the view to be resizable. Then start tracking mouse events in the view. Now, when a user drags its mouse while clicking on when of your spots, just change the view's frame accordingly. All of that should be possible to implement in a subclass of NSView.