【iOS】App imitation--3GShare


foreword

I wrote the demo of 3GShare this week. This is a very troublesome demo. It requires more design knowledge than Netease Cloud. Hereby write a blog record summary

1. Account interface

insert image description here

The account interface here is mainly usedprotocol valueIn this way, the account password we created on the pop-up registration page will be sent back to our login interface. But here is one thing to pay attention to: when we successfully register an account, and we enter the registration page again, the array of account passwords stored in the previous registration interface will be delloc'd, so we cannot judge whether the account name has been registered repeatedly. Here are two solutions :

  • Pass the array of the previous registration interface to the login interface and return the registration interface again
  • Decorate the registration interface with strong so that it will not be destroyed when it pops up

    • The first method is actually very simple, you only need to use ordinary attribute value passing to judge
    • The second method is to set our view as our property and modify it with stronginsert image description here

In this way, our interface is not destroyed, and the arrays we store in it are not released, which fulfills our need to judge whether the account has been registered repeatedly


The important thing to note here is that weIt is not possible to add the function of displaying the Alert pop-up window (warning box) in the cycle of traversing the account password array when logging in. Instead, it is necessary to first determine whether the account password matches, and then display the pop-up window.
The reason for this is that if we add the function of displaying the Alert pop-up window (warning box) in the cycle of traversing the account password array,When an alertController pops up, the second alertController cannot pop up, which leads to the fact that if the first pair of account passwords do not match, even if the latter is correct, the pop-up window of successful login will not pop up

2. Home page interface

insert image description here
This interface is very simple, using carousels and custom cells



  • Note here that my carousel will automatically scroll when I don't move. This is because I use a timer .
    The code principle I implemented here isWhen I slide the carousel, the timer will stop automatically. When I stop dragging the carousel, if the previous timer has stopped, the timer will be recreated and automatic scrolling will start
    Two protocol methods are used here.
    insert image description here
    insert image description here
    Stop the timer when you start dragging, create a timer when you end dragging, and add the timer to the runloop.
    insert image description here
    This realizes the function of restarting automatic scrolling after stopping dragging.

  • Like synchronization As
    can be seen from my gif, when I like the like button of a cell, it will add 1 when I like it, and at the same timeThe number of likes after the increase is the same as the number of likes in the new interface that pops up after clicking the cell, which uses attribute value passing, so I won’t go into details here

2. Search interface

insert image description here
There are many things designed on this page, but they are all relatively simple. What needs to be noted here is that the input box in the first page is not UITextField but UISearchBar. The focus is on the realization of the folding cell of our second page.


  • The principle of folding cells
    is relatively simple, that is, our cells are added to our tableview. Even if there are many cells, if the size of the tableview is not enough, all the cells cannot be displayed. We passClick the button to adjust the height of our tableview to realize whether the cell is fully displayed

3. Article interface

insert image description here
This is actually a combination of a simple column controller and a scroll view. It is necessary that the two controls cannot overlap.
insert image description here

4. Activity interface


Simple custom cell, but repeat

5. My interface

insert image description here
This interface was relatively cumbersome when I made it at the time. After I finished it, I felt that the difficulty was actually good, but I learned a lot of new things.

Here is what I have learned:
1. Learned how to save the pop view
2. Understand the basic code principle of the chat room, but there is still a bug that the black screen will appear when the pop-up keyboard adapts to the height and has not been resolved

The others are basically things that have already been learned, but they are more cumbersome

Summarize

Generally speaking, it is not difficult, but there are a lot of new things to learn. At the same time, many pages need to be designed with old knowledge, which is cumbersome. There are still some relatively small points that need to be summarized.

Guess you like

Origin blog.csdn.net/weixin_72437555/article/details/131811027