Is is possible to divide page control dots into two lines? - ios

I got a number of dots of page control, obviously it's too long and beyond the screen width.
Set pagecontrol=[[UIPageControl alloc] initWithFrame:CGRectMake(108, 500, 100, 50)]; to contraint its width, but looks not work.
Is it possible to divid these dots into two lines or even more?

Taking a look at the Tasks UIPageControl offers, there's no easy way to implement multi-line page control. Also, the sizeForNumberOfPages: method, there's no break mode or anything to allow you to control the number of dots per line, it will most likely just return X * dotSize, where X is the number of pages.
Also, the note On iPhone and iPod touch, about 20 page control dots fit on the screen before they are clipped says that there's no built in method to create multi-line page control.
You can of course always create a custom class, but I REALLY wouldn't suggest doing that. The user won't expect (or like) a multi-line page control anyway.
You can use something like 10 of 50 like the iBooks app uses.

Related

NSTextView - using up/down arrows moves paragraphs not lines

I have an app that runs on iOS and uses UITextView to display rich text, and also runs on Mac and uses NSTextView to display rich text. These are separate apps, but with a lot of shared code. In both cases, the {NS,UI}Textview is programmatically created and placed on a canvas.
{NS,UI}TextView will wrap long lines of text as required. Long lines are called paragraphs and have NSParagraphStyles that can be applied across the whole paragraph (line spacing, head indent etc). Each paragraph is delineated by a "\n" character (or one of the Unicode equivalents). Paragraphs wrap across multiple lines, if required.
On iOS, when you have a long paragraph covering multiple lines... if you use the down/up arrow keys, the cursor moves up and down by lines (i.e. possibly within the same paragraph), which is as you expect.
On the Mac, with the same setup, the up/down arrow keys move the cursor up and down by paragraphs (i.e. multiple lines), which is very much not what you expect.
I have attached videos of the two cursor movements so you can see what happens.
I use the same code to create the {NS,UI}TextView, and I can't see why there is a difference.
Does anyone know what's going on here? I have not interfered with the arrow key handlers in any way (although I do implement textViewDidChangeSelection: in the delegate, and can confirm that the selection is changing per my comments above).
Any ideas would be most appreciated!
Thx.
iOS Cursor Down in a UITextView.
Mac Cursor Down in an NSTextView.
Found it! It was an errant calculation in the delegate function DoCommandBySelector.

moving page number anywhere on a page in Latex

I want to print the current page number inside the defined textheight, textwidth frame on a Latex document, rather than at the page bottom.
How can I retrieve the current page number somehow for each page and then print it inside my text region? Can I call the page number up somehow on any given page? And insert it. Not as a \label or a \cite job ?
After long fumbling along trying to get that page number to show under \pagenumber or the like, I finally hit upon \thepage. If one is on p. 48, say, and wants to display that number anywhere in the text of p. 48, one simply types \thepage to have 48 appear where it is set in the text. So simple, but it stumped me.
Why did I want that? I made the page height and page width the exact dimensions of an 8.5 by 11 page. Then - unfortunately - page numbers are automatically set below the bottom edge of the printed window of every page. And become invisible!
Now I learnt how to print the current page number inside the visible page. Why did I use the full size of the paper? Because I was building a pdf file for a book and I wanted a seamless edges to edges picture on its front cover. Therefore the full size page width and page height ... Thanks!
\thepage, \thechapter etc was the answer. Sorry I asked.

Creating a signup form using a tableview in xcode (like SnapChat)

I am looking to improve my app's signup and login form from standard text boxes to using table rows (or something similar).
I am pretty much inspired by the forms which SnapChat have created, which you can see below...
I'm trying to figure out how they accomplished this, and am thinking it must be a table view with 3 cells (Static?), and the text below is part of the footer of that selection of cells.
How is one able to then capture data into it directly?
Am I right in maybe assuming that each cell is 'custom' with a text field in each one (with placeholder text) with a no-borders style on the text field?
Or has this been achieved via some other way?
Keen to hear your thoughts. Thanks!
You absolutely could do that with a table view. But I don't think this one is. Notice the divider lines start at the far left rather than at 15 pixels in (with the text). The separator lines are also two pixels tall rather than one. So I'd say it's a safe bet that it's just a simple view with 1 pixel tall UIView's for lines.

Is there a text editor with columns instead of scrolling?

Is there a text editor which offers horizontal, rather than vertical, scrolling (showing two pages side by side)?
I currently use TextMate, but would switch to any editor which offers this layout. I'm getting really bored of scrolling up and down, over and over.
I've attached a screenshot of MS Word, which has a side-by-side horizontal scroll view for documents longer than a page.
I want something like that, Any recommendations?
Emacs offers a follow-mode which you might find helpful ( see for instance here http://www.emacswiki.org/emacs/FollowMode).
A short description of how it is used and what it does:
You need to open a buffer in two windows and enter follow-mode using M-x follow-mode. This is actually a bit of a drawback, because you need to learn how to use emacs, if you don't know it already (imho learning how to use emacs is worth spending some time).
After entering follow-mode the second buffer will skip to the place where the first buffer ends, similar to the page-by-page view offered by Microsoft Word. Now if you move the cursor down one line at a time and you leave the first buffer window at the bottom, the cursor will appear at the top of the second. If you move further down and you are at the bottom of the second window, both buffers will scroll simultaneously, the same holds for page-wise scrolling using C-v and M-v.
If your monitor screen is wide enough, you can open a third window to further increase number of lines being displayed.
I have made a screenshot, which shows a text file opened in this mode: Screenshot auf Follow mode
Hmmm, it seems you are looking for layout features which you aren't likely to find in a text editor. Text editors are generally line based and don't understand the concept of pages. Text editors do things like code folding and allow lines to be wrapped or not. That is why text editors scroll in the vertical direction. These factors would affect pagination.
The concept of a page (and being able to lay them out side by side) doesn't really exist unless you are using a presentation manager such as a word processor or a desktop publishing package.
In vim: <Esc>:vsplit will open a second column for the file.
In all fairness, I should warn you that Vim has a steep learning curve, and will force you to wrap your head around new concepts like command mode / edit mode / visual mode. The results are definitely worth it, if you have the time to learn it.
I'm not sure if I know exactly what you want. Does Sublime Text 2's two-column layout with File > New View Into File do what you want?
A change on one side is reflected instantly in the other side, and you can scroll them independently. You can have up to four columns per window.
In LibreOffice Writer, go to View -> Zoom... and set Zoom factor to Fit width and height, and set View layout to Automatic. You can also set the number of columns manually, and if you choose two columns, you can use Book Mode.
With scroll-binding in vim, you can edit two files side by side: scroll-binding in Vim.
Show a text file with two columns in vim: http://vim.wikia.com/wiki/View_text_file_in_two_columns

Read database, put the text in two columns to fill them, and same the rest iPad

I want to build an app for iPad like a book, with two pages, with one column each.
After read some text from a database, I want to fulfill the two pages (with the right quantity of text), and save whats left to the next page. I will display some images between the text, and I need to make the text and image to fit in each page.
I'm thinking in use a UIWebView to hold the text.
My problem it's calculate the amount of text needed for each page and the text that left.
Can you help me doing that?
I will display some images between the text, and I need to make the text and image to fit in each page.
UIWebView is the wrong UI element to use if you just want to display text. You should know that loading a UIWebView takes long and eats up a lot of memory. This is a job for UITextView.
To calculate the text that will fit on a page, you will have to use the methods that UIKit adds to NSString. Here is the documentation. These help you to calculate the size a string will be when rendered with a certain font and certain line break mode.
CGSize renderedTextSize = [myString sizeWithFont:myFont forWidth:myTextView.frame.size.width lineBreakMode:UILineBreakModeWordWrap];
You could write a method that would use these methods calculate a substring of the text that will fit on your current "page" (UITextView). Then, for the next "page", start from where you left off on the last page and add text to that string until it fits perfectly in your text view (maybe you add words until it gets too big to fit, then take out the last word and return that substring).
Something like that should work.

Resources