MCP cover image
See in Github
2012-07-21

用自定义图像替换UipageControl

9

Github Watches

15

Github Forks

47

Github Stars

MCPagerView

Project goal

Make a replacement for the UIPageControl, with a similar functionality but custom "dots".

Here is a screenshot from the sample project:

Sample project screenshot

License

This code is available under the MIT license.

Installation

  1. Drag files from the Classes folder to your project;
  2. #import "MCPagerView.h" wherever you want to use it.

Usage

Initialize the MCPagerView as you would do with any other view: either add a view in the Interface Builder and set a "MCPagerView" class on it or create one programmatically with a code like this:

[MCPagerView alloc] initWithFrame:CGRectMake(0,0,6*44,44)];

Actual values will depend on the sizes and the number of "dots".

Set the "pattern". Number of characters in the pattern will determine the number of pages and what kind of "dot" will be used for each of them. Here is the example from the sample project:

[pagerView setPattern:@"abcabc"];

This pager will have 6 pages with dot types "a", "b" and "c".

Now images should be specied for each of the dot types:

[pagerView setImage:[UIImage imageNamed:@"a"]
   highlightedImage:[UIImage imageNamed:@"a-h"]
             forKey:@"a"];

In this example, dot "a" is set up with "a.png" as the default value and "a-h.png" as a "highlighted" value. Dot is highlighted when it corresponds to the current "page" property.

Current page can be read or set by accessing the "page" property:

pagerView.page = 3;

A delegate can be set to receive updates to the pager:

pagerView.delegate = self;

Delegate should implement the "MCPagerViewDelegate" protocol. This protocol has two optional methods:

- (BOOL)pageView:(MCPagerView *)pageView shouldUpdateToPage:(NSInteger)newPage;
- (void)pageView:(MCPagerView *)pageView didUpdateToPage:(NSInteger)newPage;

Here is a simple "go to page" code from the sample project:

- (void)pageView:(MCPagerView *)pageView didUpdateToPage:(NSInteger)newPage
{
    CGPoint offset = CGPointMake(scrollView.frame.size.width * pagerView.page, 0);
    [scrollView setContentOffset:offset animated:YES];
}

Alternatively, an object can observe the "MCPAGERVIEW_DID_UPDATE_NOTIFICATION" notification on the default notification center:

[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(onPageChange)
                                             name:MCPAGERVIEW_DID_UPDATE_NOTIFICATION
                                           object:pagerView];

相关推荐

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • Lists Tailwind CSS classes in monospaced font

  • https://appia.in
  • Siri Shortcut Finder – your go-to place for discovering amazing Siri Shortcuts with ease

  • https://zenepic.net
  • Embark on a thrilling diplomatic quest across a galaxy on the brink of war. Navigate complex politics and alien cultures to forge peace and avert catastrophe in this immersive interstellar adventure.

  • jae-jae
  • MCP服务器使用剧作《无头浏览器》获取网页内容。

  • Mintplex-Labs
  • 带有内置抹布,AI代理,无代理构建器,MCP兼容性等的多合一桌面和Docker AI应用程序。

  • ravitemer
  • 一个功能强大的Neovim插件,用于管理MCP(模型上下文协议)服务器

  • patruff
  • Ollama和MCP服务器之间的桥梁,使本地LLMS可以使用模型上下文协议工具

  • pontusab
  • 光标与风浪冲浪社区,查找规则和MCP

  • WangRongsheng
  • 🧑‍🚀 llm 资料总结(数据处理、模型训练、模型部署、 o1 模型、mcp 、小语言模型、视觉语言模型)|摘要世界上最好的LLM资源。

  • n8n-io
  • 具有本机AI功能的公平代码工作流程自动化平台。将视觉构建与自定义代码,自宿主或云相结合,400+集成。

  • av
  • 毫不费力地使用一个命令运行LLM后端,API,前端和服务。

  • appcypher
  • 很棒的MCP服务器 - 模型上下文协议服务器的策划列表

  • 1Panel-dev
  • 🔥1Panel提供了直观的Web接口和MCP服务器,用于在Linux服务器上管理网站,文件,容器,数据库和LLMS。

    Reviews

    5 (1)
    Avatar
    user_NIMSHD2w
    2025-04-17

    MCPagerView by Baglan is a fantastic component for iOS developers looking to implement a pager view. Its ease of integration and intuitive design make it a pleasure to use. Highly recommend checking it out on GitHub: https://github.com/Baglan/MCPagerView. Fantastic job, Baglan!