is there any method to get the row and column number in a uitextview - iphone

I am trying to achieve a task in which the user the will create notes just like iNotes.app, for this i have to give some padding from left, in my case the padding is little more than the actual iNotes(app) and the problem with this is, If I complete the whole line it goes out of view/screen and user cant see.
To solve this Issue I first I used
UIEdgeInsetsMake(0,40,0,-40);
//this thing makes the content non-scrollable horizontaly
//but the text still goes out of screen
Then I used
UIEdgeInsetsMake(0,40,0,0);
//By doing this the content becomes horizontally
//scrollable and the content appear as per scrolling.
I don't want my textview to scroll Horizontally and I want it to show the content without cutting anything.
Please guide my what should I do to tackle this problem and
If my approach is wrong please suggest any other way. Thanks in Advance :)

Related

Flutter/Dart Datatable or Sliver with fixed header and fixed row header

So I want to create a data view for a Flutter app that incorporates a datatable or sliver (or anything really) with a fixed header when scrolling vertically and also fixed row headers when scrolling horizontally. I tried messing around with the data_table_2 and table_sticky_headers plugins, but they don't do exactly what I want. I'm hoping someone can point me in the right direction or help come up with a solution.
Here's a gif image showing what I want to achieve...
Data View Idea
I figured it out. It was pretty simple actually, using nested Stack's and SingleChildScrollView's. No plug-ins required.
Here's a link to the example source code if anyone is interested...
https://github.com/jstoyles/flutter_data_view_idea

Flutter horizontal text page view?

I have been scouring the web for a while about this, and have yet to find anything that works well.
I am building a flutter application that requires an “e-reader”-esque widget. This should be able to accept a looooooooooong text object, with potential paragraph indentations in the form of \n, and then have a horizontal pageview where the text that doesn’t fit in each page overflows to the next page.
So far I have tried pageview.builder where you (very slowly) add one word at a time, determine the height of the text object, and then either add another word or move to the next page if it does not fit in the viewport height. I have also tried a similar method with entire paragraphs, and a solution involving multiple locked listviews where the text scrolls equal to the viewport height whenever you swipe.
None of these implementations work particularly well, and all of them feel over-complicated.
Is there a good way of accomplishing this that anyone recommends?

Keep cursor position on bottom line in textView Swift

I need to create a UI where, as the user types, the cursor/typing area stays in the middle of the page and the newly typed text is pushed 'up and off' the top of the page.
I've tried to set the cursor position to the bottom of a text view which covers 0.6 of the superview but that doesn't work (presumably because it doesn't have any text?). This is a great answer for general cursor placement but my use case isn't catered for.
The code I used to try place the cursor at the end of the text view is :
func setCursorPosition() {
let newPosition = textViewOutlet.endOfDocument
textViewOutlet.selectedTextRange = textViewOutlet.textRange(from: newPosition, to: newPosition)
}
This doesn't work because it is looking for filled in text but sometimes the text view would be empty and I'd still need to load it on the bottom line.
The effect I'm trying to create would look like this :
quite a complex problem I think - any ideas?
For people who have this problem in future. I solved this by coming at it from a different angle. Rather than attempting to place the cursor half way down the page, I removed the height constraints and made the text view dynamically resize based on the content.
Then I adjusted the constraints (helped by this answer) to fix the space to the bottom safe area but didn't specify a height.
This way, the text view dynamically resizes but in an upwards direction. When it reaches the gradient I have placed over the frame it starts to fade out.
Perfect (I also disabled scrolling to make this work)
Top tip - if something seems really hard there might be a different way to approach the problem!

`ListView` not scrolling to exact position when a few list item are of big height

I'm using ListView to display my dynamic content. Based on selected option, I've to scroll to some specified position in ListView. This works great when the list item height is not that big, i.e. it covers the whole screen. But when big height item are present in list, the scroll doesn't take me to proper position, instead it takes to some in between position. I tried using both of the following but same result.
listView.smoothScrollToPosition(myItems.indexOf(thisItem));
listView.setSelection(myItems().indexOf(thisItem));
Can anybody point the possible cause of the issue and also give some suggestions.
The workaround suggested here worked for me except that I called both functions, smoothScrollToPosition and setSelection, sequentially instead of using OnScrollListener. Though its not giving smooth scrolling effect but it's fulfilling my requirement. If any body can suggest a more proper solution, it's welcomed.

Turning scrollbar, ListView into timeline slider

I've been seeing this UI technique quite often at Dribbble, mostly demonstrated on iPhone as timeline, and I am really wondering if it's possible to do so on Android. The idea is to exploit scrollbar, make it activate each row it is passing.
Consider these schematics of a list of contact.
The first one is the list (photos on the left side, names on the right) split roughly in the middle with scroll track.
The scrollbar cannot expand and has to be smaller than the smallest row. I believe it is possible to produce this kind of arrangement by combining two listviews and make them roll together.
The second one shows the screen when scrolled and when the scrollbar moves to the second row. After it stops, the second row will expand its height. All hidden elements there like address, phone, etc will show up. Also, the moment the scrollbar leaves the first row / hits the second, the first row will toggle off. It will shrink and remove all elements except name.
I have been thinking about this scenario and one key question in this technique is whether the scrollbar has the ability to activate the row it hits. The only tool I know in regard to scrolling is onScrollListener but I wonder if it's sufficient. Does anyone have any insight into such scenario ?
Thank you in advance.
I've been seen something similar to this in lots of applications. Some of them are just using ListView with design tricks to look like that, others with custom views or something else. The idea which I have in my about this implementation is using two Fragments: left and right which are placed in one FragmentActivity. Left Fragment will be your image holder, where for example you will have a ListView or some other view depending on your choice which will communicate with the Right Fragment and when LeftFragment's ListView stop scrolling, fire an event to RightFragment's ListView to scroll to position 5 for example and expand that item. Not really sure if it's the best option and if it will work properly as you want, but that's the first idea which I can think of to do some implementation like this.
Hope this help you find the right answer.